WorksheetsPage 1
Total questions: 50
Worksheet time: 37mins
A problem-solving approach includes
Coding only
Testing only
Algorithm and flowchart
Debugging only
Which data type stores unique values?
List
Tuple
Set
Dictionary
Python is a
Low-level language
Assembly language
High-level interpreted language
Machine language
Who developed Python?
Dennis Ritchie
James Gosling
Guido van Rossum
Bjarne Stroustrup
Python programs are executed using
Compiler only
Interpreter
Assembler
Linker
Which data type is immutable in Python?
List
Dictionary
Tuple
Set
Which symbol is used for comments in Python?
//
/* */
#
<!-- -->
Which keyword is used for conditional branching?
for
if
while
break
The range(1,5) function generates
1,2,3,4
1,2,3,4,5
0,1,2,3,4
Error
Which loop is used when number of iterations is known?
while
do-while
for
switch
Which statement terminates a loop prematurely?
continue
exit
break
pass
Which operator is used for exponentiation?
^
**
%
//
What is the output of: 5//2?
2.5
3
2
Error
A function is defined using keyword
function
define
def
fun
Which function returns length of a string?
size()
count()
len()
length()
Default arguments are
Mandatory
Optional
Invalid
Global
Which operator concatenates strings?
*
+
&
%
Which method converts string to uppercase?
upper()
capitalize()
lower()
swap()
Lambda functions are
Named functions
Recursive functions
Anonymous functions
Built-in functions
Which function is used to open a file?
open()
file()
read()
write()
File opened in write mode uses
r
w
a
x
Which method reads entire file content?
readline()
readlines()
read()
open()
Dictionary stores data in the form of
Index-value
Key-value pairs
Lists
Sets
Which symbol defines a dictionary?
()
[]
{}
<>
Which method returns dictionary keys?
keys()
values()
items()
get()
OOP stands for
Object Oriented Programming
Open Operation Program
Optional Object Programming
Object Operating Platform
A class is
Object
Blueprint of object
Method
Variable
An object is an
Instance of a class
Method
Constructor
Function
Which keyword refers to current object?
this
self
current
object
Constructor method in Python is
init
start
create
main
Inheritance represents
HAS-A relationship
USES relationship
IS-A relationship
PART-OF relationship
Which feature allows same function name with different behaviour?
Encapsulation
Abstraction
Inheritance
Polymorphism
Data hiding is achieved using
Polymorphism
Encapsulation
Inheritance
Abstraction
Which of the following is mutable?
Tuple
String
List
Integer
Output of: print(type(10))
int
<class 'int'>
integer
number
Which keyword is used to handle exceptions?
try
catch
throw
final
Which block executes always?
try
except
finally
raise
Python supports
Only OOP
Only procedural
Multiple paradigms
Only functional
Which function takes user input?
input()
scan()
read()
get()
Which statement does nothing?
break
continue
pass
return
Python index starts from
0
1
-1
Any number
Which operator checks equality?
=
==
!=
<=
What is the output of bool(0)?
True
False
0
Error
Which keyword is used to exit function?
break
stop
return
exit
Python file extension is
.pt
.java
.py
.p
What is the output of len([1,2,3,4])?
3
4
5
Error
Which method adds element to list?
add()
insert()
append()
push()
What does continue do?
Stops loop
Skips current iteration
Ends program
Restarts loop
Which type of inheritance is supported by Python?
Single
Multiple
Multilevel
All of the above
Which is NOT an OOP principle?
Encapsulation
Abstraction
Compilation
Polymorphism
