Python Question Bank
Python Question Bank
Gurgaon, HR
Question Bank
SECTION-A
a) demoFunction() 1
b) def demoFunction()
c) function demoFunction()
d) void demoFunction()
Q4 Which statement is used to bring control to the 2
beginning of the loop? 1
a) for b) break
c) continue d) none of the above
Q5 Which of the following statement is not used for 3
exception handling ? 1
a) try b) except
c) finally d) if
Which of the following are greedy match
6 quantifiers?
a) ‘*’ 1
b) ‘+’ 4
c) ‘?’
d) all above
Q7 4
Which function is used to open a file in Python? 1
a) file () b) new()
c) open() d) none of these
Q11 4
Which code is used to open a file for binary writing? 1
a) “w”
b) “wb”
c) “r+”
d) “a”
Q12 Which of the following functions returns a list 1
containing all matches?
a) Find b) Findall
c) Search d) None of the above
a) List b) Dictionary
C Tuples d)
None of the
above
a) Set b) Lists
c) Tuples d) None of the above
How to access
a value in
Q17 Tuple? 1 1
a) mytuple (1)
b) mytuple [1]
c) mytuple {1}
d) None of the above
Q18 The following is an example of an invalid variable? 1 1
a)
xyz_
1 b) 1st
c)
foo d) _qwe
Q19 2
A variable in Python with value 42.6
1
a) int a = 42.6
b) a = 42.6
c) integer a = 42.6
d) None
Q20 2
How to access a value in List?
a) mylist() b) mylist[] 1
c) mylist {} d) none
SECTION-B
3
Q22 Is Python is an object-oriented language? (T/F) 1 1
1
SECTION-C
Q40 2
Write a program in Python to check if a number is prime or not. 1
Q41 Explain the nesting of loops in python with example 2 2
SECTION-D
Q44 2
Explain the use of various types of operators in python
2
What do you be Tuples in Python. Explain various type
Q45 of operation of tuples. 1 2