ADICHUNCHANAGIRI INSTITUTE OF TECHNOLOGY,
Department of Computer Science & Engineering
Introduction to Python Programming-BPLCK205B
Activity Based Learning: QUIZ
Name: USN: SEC: DATE:
Q.no Questions ANS
1 Who developed Python Programming Language?
a) Wick van Rossum b) Rasmus Lerdorf c) Guido van Rossum d) Niene Stom
2 Which of the following is used to define a block of code in Python language?
a) Indentation b) Key c) Brackets d) All of the mentioned
3 What will be the value of the following Python expression?
>>> 4 + 3 % 5
a) 7 b) 2 c) 4 d) 1
4 Which keyword is used for function in Python language?
a) Function b) def c) Fun d) Define
5 Which of the following character is used to give single-line comments in Python?
a) // b) # c) ! d) /*
6 What is output of print(math.pow(3, 2))?
a) 9.0 b) None c) 9 d) None of the mentioned
7 Is Python case sensitive when dealing with identifiers?
a) yes b) no c) machine dependent d) none of the mentioned
8 Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len (listExample)?
a) 5 b) 4 c) None d) Error
9 Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?
a) 3 b) 5 c) 25 d) 1
10 Which of the following is a Python tuple?
a) [1, 2, 3] b) (1, 2, 3) c) {1, 2, 3} d) {}
11 Which of the following statements create a dictionary?
a) d = {} b) d = {“john”:40, “peter”:45}
c) d = {40:”john”, 45:”peter”} d) All of the mentioned
12 What will be the output of the following Python function?
len(["hello",2, 4, 6])
a) Error b) 6 c) 4 d) 8
13 To open a file c:\scores.txt for writing, we use
a)outfile = open(“c:\scores.txt”, “w”) b) outfile = open(“c:\\scores.txt”, “w”)
c)outfile=open(file = “c:\scores.txt”, “w”) d)outfile = open(file=“c:\\scores.txt”, “w”)
14 The readlines() method returns
a)str b)a list of lines c)a list of single characters d)a list of integers
15 Which is the correct operator for power(xy)?
a) X^y b) X**y c) X^^y d) None of the mentioned
16 What will be the output of the following Python code?
>>>t= (1, 2, 4, 3)
>>>t [1:-1]
a) (1, 2) b) (1, 2, 4) c) (2, 4) d) (2, 4, 3)
17 What will be the output of the following Python code?
>>> a={ ‘B’:5, ‘A’:9, ’C’:7 }
>>> sorted(a)
a) [‘A’,’B’,’C’] b) [‘B’,’C’,’A’] c) [5,7,9] d) [9,5,7]
18 Operators with the same precedence are evaluated in which manner?
a) Left to Right b) Right to Left c) Can’t say d) None of the mentioned
19 is used to create an object.
a) class b) constructor c) User-defined functions d) In-built functions
20 represents an entity in the real world with its identity and behavior.
a) A method b) An object c) A class d) An operator