CSC COMPUTER EDUCATION PVT LTD COMMON EXAM PYTHON LANGUAGE
MARKS: 60 DURATION: 1.00 HRS DATE: ________ STAFFNAME: _________
ENO: _______ COURSE: ___________ NAME: __________________________
ANSWER THE FOLLOWING: 24. What are the two main types of functions in Python?
1. Who developed the Python language? a. System function b. Custom function
a. Zin Den b. Guido van Rosan c. Niene Stom c. Built-in function & User defined function
2. What do we use to define a block of code in Python 25. How many except statements can a try-except block
language? a. Key b. Brackets c. Indentation have? a. zero b. one c. more than one d. more than zero
3. Which character is used in Python to make a single 26. In which year was the Python language developed?
line comment? a. / b. // c. # d.! a. 1995 b.1972 c.1981 d.1989
4. Which of the following statements is correct regarding 27. Which of the following operators is the correct
the object-oriented programming concept in Python? option for power(ab)? a. a ^ b b. a**b c. a ^ ^ b
a .Classes are real-world entities while objects are not 28. >>>"a"+"bc" What will be the output of this
real statement? a. a+bc b. abc c. a bc d. a
b. Objects are real-world entities while classes are not
29. Which of the following types of loops are not
real
supported in python?
c .Both objects and classes are real-world entities
a. for b. while c. do-while d. none of the above
5. What is the method inside the class in python
language? a. Object b. Function c. Attribute
30. Which of the following blocks will always be
6. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1
executed whether an exception is encountered or not in
after [Link](1) ?
a program? a. Try b. Except c. Finally
a. [3, 4, 5, 20, 5, 25, 1, 3] b. [20, 5, 1, 3, 4, 5, 3]
c. [1, 3, 3, 4, 5, 5, 20, 25] d. [3, 5, 20, 5, 25, 1, 3]
31. Which of the following concepts is not a part of
Python? a. Pointers b. Loops c. Dynamic Typing
7. What is called when a function is defined inside a
class? A. Module b. Another Function c. Method
32. What is Python? a. a programming language
8. Which type of Programming does Python support?
b. Computer language c. Binary language
a. Object-oriented programming
b. Structured programming
33. Python provides ______&_______ levels of access
c. Functional programming d. All of the mentioned
to network programming.
9. Which keyword is used for function in Python?
a. Function b. Def c. Fun d. Define
34. What will be the type of the variable sort in the
10. Is Python code compiled or interpreted?
below code?
a. Python code is both compiled and interpreted
Num= (4, 7, 19, 2, 89, 45, 72, 22)
b. Python code is neither compiled nor interpreted
Sort = sort(Num)
12. Multithreading is a way of achieving ________
print(Sort)
a. Multitasking b. Single task c. None of these
[Link] b. Tuple c. String d. int
13. Python is ______ level programming language.
14. Which function define something in terms of itself ?
a. Recursive b. Module c. Function d. Argument 35. What will be the output of the following code?
15. In list index position always starts with the value ___ ex = ["Sunday", "Monday", "Tuesday", "Wednesday"]
16. A set is created by placing all the items inside _____ del ex[2]
a. Curly braces b. Square brackets c. Parenthesis print(ex)
17. Dictionary has a _________ a. ['Sunday', 'Monday', 'Tuesday', 'Wednesday']
18. A variable which is declared inside a function is b. ['Sunday', 'Monday', 'Wednesday']
a .local b. Global c. Constant d. parameter c. ['Monday', 'Tuesday', 'Wednesday']
19. Which word is used to find the data type of the
variables ? a. Class b. Type c. Object d. Del 36. How to add a single-line comment in Python?
20. Counter() method is used in _______ a. /* This is a comment */ b. !! This is a comment
21. Which of the following is the correct extension of c. // This is a comment d. # This is a comment
the Python file? a. .python b. .pl c. .py d. .p 37. ________ uses square brackets for comma-separated
22. Which of the following functions is a built-in values in Python? a. Lists b. Dictionary c. Tuples
function? a. Factorial() b. Print() c. Seed() d. Sqrt()
38. Are Python Tuples faster than Lists? a. True b. False
23. What arithmetic operators cannot be used with
strings? a. * b. – c. + d. All of these 39. The def keyword is used in Python to define?
a. Function name b. List c. Array d. Dictionary
40. Which method is used to get the total length of a b. Parameters define, arguments call
Tuple in Python? a. Count() b. Length() c. Len() c. Arguments define, parameters call
41. Is using a return statement optional in a Python 55. What is the purpose of the open() function?
Function? a. True b. False a. To read data from URL b. To open a new Python file
c. To open a file d. To create a Python module
42. How to get the type of a variable in Python?
a. print(typeOf(a)) b. print(typeof(a)) c. print(type(a)) 56. Which file mode in Python allows you to read and
43. Which one of these correctly convert int to float ? write to a file? a. r+ b. w+ c. a+ d. rb+
a. Res = float(10) b. Res = converttofloat(10)
57. i = 1:
44. What is the correct way to get the length of a List? while True:
a. length(mylist) b. count(mylist) c. len(mylist) if i%3 == 0:
break
45. Which of the following is not the build-in error type? print(i)
a. EOF error b. Key error c. Loop error d. Index error Which of the following is the correct output of this
program? a. 1 2 3 b. 3 2 1 c. 1 2 d .Invalid syntax
46. What type of error will be raised when the imported 58. _______ python file contains python definitions and
module is not found? a. NULL Error b. Import Error statements.
47.i = (2, 10) 59. There are _____ levels of log messages in python.
j = (3, 5)
add = i + j 60. T he three types of numeric literals in python _____,
print(add) ________and ________ .
a. (5, 10) b. 20 c. (2, 10, 3, 5)
48. What will be the output of the following code?
try:
x=1/0
exceptZeroDivisionError:
print("Error")
a. 0 b. 1 c. Error d. invalid syntax
49. What is a class in Python?
a. A blueprint for creating objects
b. A function inside an object
c. A variable inside an object
50. In Python, what is 'self' in a class method?
a. A variable that holds the class name
b. A reference to the class itself
c. A reference to the instance that calls the method
51. What is a dictionary in Python?
a. An ordered collection of elements
b. A mutable collection of key-value pairs
c. A collection of unique elements
52. How can you remove a key-value pair from a
dictionary? [Link] b. remove() c. pop() d. Both a & c
53. In Python, what is a module?
a. A data type b. A built-in function
c. A file with definitions d. A code block
54. What is the difference between arguments and
parameters ? a. Based on data type