Font size
S
M
L
XL
Worksheetspython125
Total questions: 125
Worksheet time: 1hrs 3mins
Name
Class
Date
1.
To install python in the Windows system windows must support ________
a)
Framework
b)
Service pack
c)
.net
d)
Microsoft Installer 2.0
2.
Which of the following operators is the correct option for power(ab)?
a)
a ^ b
b)
a**b
c)
a ^ ^ b
d)
a ^ * b
3.
Which one of the following has the same precedence level?
a)
Division, Power, Multiplication, Addition and Subtraction
b)
Division and Multiplication
c)
Subtraction and Division
d)
Power and Division
4.
Which of the following words cannot be a variable in python language?
a)
_val
b)
val
c)
try
d)
_
5.
What is the result of the snippet of code shown below if x=1? x<<2
a)
8
b)
1
c)
2
d)
4
6.
Which one of these is floor division?
a)
/
b)
//
c)
%
d)
none of the mentioned
7.
_____ is used to create an object.
a)
A method
b)
An object
c)
A class
d)
An Constructor
8.
All classes have a function called?
a)
__init__
b)
__init__()
c)
init
d)
init()
9.
The __________ parameter is a reference to the current instance of the class, and is used to access
a)
__init__()
b)
self
c)
both A and B
d)
None of the above
10.
create a class, use the keyword?
a)
new
b)
except
c)
class
d)
object
11.
__________ is the modeling of the data description, data semantics, and consistency constraints of the data.
a)
data model
b)
relational model
c)
Entity-Relationship Data Model
d)
network model
12.
An advantage of the database management approach is
a)
Data is dependent on programs
b)
Data redundancy increases.
c)
Data is integrated and can be accessed by multiple programs.
d)
None of the above
13.
Which of the following provides the ability to query information from the database and insert tuples into, delete tuples from, and modify tuples in the database?
a)
DML(Data Manipulation Language)
b)
DDL(Data Definition Language)
c)
Query
d)
Relational Schema
14.
For what purpose the DML is provided?
a)
Addition of new structure in the database
b)
Manipulation & processing of the database
c)
Definition of the physical structure of the database system
d)
All of the above
15.
Which of the following is not a DDL command?
a)
TRUNCATE
b)
ALTER
c)
CREATE
d)
UPDATE
16.
Which of the following are TCL commands?
a)
COMMIT and ROLLBACK
b)
UPDATE and TRUNCATE
c)
SELECT and INSERT
d)
GRANT and REVOKE
17.
Intersection is performed using
a)
INT
b)
&
c)
intersection
d)
both b &c
18.
Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
a)
d.size()
b)
len(d)
c)
size(d)
d)
d.len()
19.
What will be the output of below Python code? tuple1=(5,1,7,6,2) tuple1.pop(2) print(tuple1)
a)
(5,1,6,2)
b)
(5,1,7,6)
c)
(5,1,7,6,2)
d)
Error
20.
What will be the output of below Python code? list1=[8,0,9,5] print(list1[::-1])
a)
[5,9,0,8]
b)
[8,0,9]
c)
[8,0,9,5]
d)
[0,9,5]
21.
What will be the output of following Python code? set1={0,0,9} print(set1)
a)
{0,0,9}
b)
{0,9}
c)
{9}
d)
It will throw an error as there are two 0 while creating the set.
22.
Which of the following is not an advantage of using modules?
a)
Provides a means of reuse of program code
b)
Provides a means of dividing up tasks
c)
Provides a means of reducing the size of the program
d)
Provides a means of testing individual parts of the program
23.
Which of these is the definition for packages in Python?
a)
A folder of python modules
b)
A set of programs making use of Python modules
c)
A set of main modules
d)
A number of files containing Python definitions and statements
24.
Where is function defined?
a)
Module
b)
Class
c)
another function
d)
All the above
25.
if a function doesn’t have a return statement, which of the following does the function return?
a)
int
b)
null
c)
None
d)
Error
26.
In which language is Python written?
a)
English
b)
PHP
c)
C
d)
All of the above
27.
Which is the correct operator for power?
a)
X^y
b)
X**y
c)
X^^y
d)
None of the mentioned
28.
What is the result of the expression: int(1011)?
a)
Different
b)
Error
c)
Same
d)
none of the mentioned
29.
Which one of the following has the same precedence level?
a)
Division, Power, Multiplication, Addition and Subtraction
b)
Division and Multiplication
c)
Subtraction and Division
d)
Power and Division
30.
Which of the following operators is the correct option for power(ab)?
a)
a ^ b
b)
a**b
c)
a ^ ^ b
d)
a ^ * b
31.
All keywords in Python are in_________
a)
lower case
b)
UPPER CASE
c)
Capitalized
d)
None of the mentioned
32.
____ uses a list of instructions to do computation step by step.
a)
Procedural programming
b)
Object-oriented programming
c)
Language
d)
Program
33.
What is the biggest reason for the use of polymorphism?
a)
It allows the programmer to think at a more abstract level
b)
There is less program code to write
c)
The program will have a more elegant design and will be easier to maintain and update
d)
Program code takes up less space
34.
The destructor has a special name
a)
INIT
b)
DEL
c)
Destroy
d)
Erase
35.
_____ represents an entity in the real world with its identity and behaviour.
a)
A method
b)
An object
c)
A class
d)
An operator
36.
__________data is organised more like a graph, and are allowed to have more than one parent node.
a)
data model
b)
relational model
c)
Entity-Relationship Data Model
d)
network model
37.
Database can be used in the following:
a)
Bank
b)
airline
c)
university
d)
all the above
38.
Which of the following are TCL commands?
a)
COMMIT and ROLLBACK
b)
UPDATE and TRUNCATE
c)
SELECT and INSERT
d)
GRANT and REVOKE
39.
Which of the following is generally used for performing tasks like creating the structure of the relations, deleting relation?
a)
DML(Data Manipulation Language)
b)
Query
c)
Relational Schema
d)
DDL(Data Definition Language)
40.
Which of the following is not a DDL command?
a)
TRUNCATE
b)
ALTER
c)
CREATE
d)
UPDATE
41.
For what purpose the DML is provided?
a)
Addition of new structure in the database
b)
Manipulation & processing of the database
c)
Definition of the physical structure of the database system
d)
All of the above
42.
What will be the output of following Python code? set1={2,5,3} set2={3,1} set3={} set3=set1&set2 print(set3)
a)
{3}
b)
{}
c)
{2,5,3,1}
d)
{2,5,1}
43.
Intersection is performed using
a)
INT
b)
&
c)
intersection
d)
both b &c
44.
The elements of a list are arranged in descending order. Which of the following two will give same outputs? i. print(list_name.sort()) ii. print(max(list_name)) iii. print(list_name.reverse()) iv. print(list_name[-1])
a)
i, ii
b)
i, iii
c)
ii, iii
d)
iii, iv
45.
What will be the output of below Python code? tuple1=(5,1,7,6,2) tuple1.pop(2) print(tuple1)
a)
(5,1,6,2)
b)
(5,1,7,6)
c)
(5,1,7,6,2)
d)
Error
46.
What is the output of the following piece of code? >>> a=(2,3,1,5) >>> a.sort() >>> a
a)
a=(1,2,3,5)
b)
a=(5,3,2,1)
c)
None
d)
Error as tuple is immutable
47.
How is a function declared in Python?
a)
def function function_name():
b)
declare function function_name():
c)
def function_name():
d)
declare function_name():
48.
Which of the following keyword is a valid placeholder for body of the function ?
a)
PASS
b)
BREAK
c)
CONTINUE
d)
END
49.
Which keyword is use for function?
a)
Fun
b)
Def
c)
Define
d)
function
50.
Which one of the following is the correct way of calling a function?
a)
function_name()
b)
call function_name()
c)
ret function_name()
d)
function function_name()
51.
Python is said to be easily
a)
readable language
b)
writable language
c)
bug-able language
d)
script-able language
52.
Which is the correct operator for power?
a)
X^y
b)
X**y
c)
X^^y
d)
None of the mentioned
53.
Which character is used in Python to make a single line comment?
a)
/
b)
//
c)
#
d)
!
54.
All keywords in Python are in_________
a)
lower case
b)
UPPER CASE
c)
Capitalized
d)
None of the mentioned
55.
Is Python case sensitive when dealing with identifiers?
a)
yes
b)
no
c)
machine dependent
d)
none of the mentioned
56.
Which of the following words cannot be a variable in python language?
a)
_val
b)
val
c)
try
d)
_
57.
What is the biggest reason for the use of polymorphism?
a)
It allows the programmer to think at a more abstract level
b)
There is less program code to write
c)
The program will have a more elegant design and will be easier to maintain and update
d)
Program code takes up less space
58.
_____ is used to create an object.
a)
A method
b)
An object
c)
A class
d)
An Constructor
59.
The constructor has a special name
a)
INIT
b)
DEL
c)
CREATE
d)
NEW
60.
The __________ parameter is a reference to the current instance of the class, and is used to access
a)
__init__()
b)
self
c)
both A and B
d)
None of the above
61.
is based on normalizing data in the rows and columns of the tables.
a)
Hierarchical
b)
network
c)
relational
d)
Object-Oriented
62.
Which model data is organized in a tree-like structure.
a)
Hierarchical
b)
network
c)
relational
d)
Object-Oriented
63.
What is the full form of SQL?
a)
Structured Query List
b)
Structure Query Language
c)
Sample Query Language
d)
None of these.
64.
Which of the following is generally used for performing tasks like creating the structure of the relations, deleting relation?
a)
DML(Data Manipulation Language)
b)
Query
c)
Relational Schema
d)
DDL(Data Definition Language)
65.
Which of the following statement is true?
a)
TRUNCATE free the table space while DELETE does not.
b)
Both TRUNCATE and DELETE statements free the table's space.
c)
Both TRUNCATE and DELETE statement does not free the table's space.
d)
DELETE free the table space while TRUNCATE does not.
66.
_________ command makes the updates performed by the transaction permanent in the database?
a)
ROLLBACK
b)
COMMIT
c)
TRUNCATE
d)
DELETE
67.
10. Which of the following two Python codes will give same output? (i) print(tupl[:-1]) (ii) print(tupl[0:5]) (iii) print(tupl[0:4]) (iv) print(tupl[-4:])
a)
i, ii
b)
ii, iv
c)
i, iv
d)
i, iii
68.
What is the output of the following code? >>> a=(1,2,3,4) >>> del(a[2])
a)
a=(1,2,4)
b)
a=(1,3,4)
c)
a=(3,4)
d)
Error as tuple is immutable
69.
What will be the output of below Python code? list1=[8,0,9,5] print(list1[::-1])
a)
[5,9,0,8]
b)
[8,0,9]
c)
[8,0,9,5]
d)
[0,9,5]
70.
Which of the following will delete key_value pair for key="tiger" in dictionary? dic={"lion":"wild","tiger":"wild","cat":"domestic","dog":"domestic"}
a)
del dic["tiger"]
b)
dic["tiger"].delete()
c)
delete(dic.["tiger"])
d)
del(dic.["tiger"])
71.
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
72.
What is a recursive function?
a)
A function that calls other function.
b)
A function which calls itself.
c)
Both A and B
d)
None of the above
73.
What is a variable defined inside a function referred to as?
a)
A global variable
b)
A local variable
c)
A static variable
d)
An automatic variable
74.
What is the output of the following piece of code? def a(b): b = b + [5] c = [1, 2, 3, 4] a(c) print(len(c))
a)
4
b)
5
c)
1
75.
Which of the following keyword is a valid placeholder for body of the function ?
a)
PASS
b)
BREAK
c)
CONTINUE
d)
END
76.
Python be used as a scripting language or can be compiled to________ for building large applications.
a)
object code
b)
source code
c)
byte-code
d)
hexa code
77.
Which of the following functions is a built-in function in python language?
a)
val()
b)
print()
c)
printf()
d)
None of these
78.
Study the following program: i = 1: while True: if i%3 == 0: break print(i) 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
79.
Which of the following operators is the correct option for power(ab)?
a)
a ^ b
b)
a**b
c)
a ^ ^ b
d)
a ^ * b
80.
What is the maximum possible length of an identifier?
a)
31 characters
b)
63 characters
c)
79 characters
d)
none of the mentioned
81.
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
82.
What type of inheritance is illustrated in the following Python code? class A(): pass class B(): pass class C(A,B): pass
a)
Multi-level inheritance
b)
Multiple inheritance
c)
Hierarchical inheritance
d)
Single-level inheritance
83.
The __________ parameter is a reference to the current instance of the class, and is used to access
a)
__init__()
b)
self
c)
both A and B
d)
None of the above
84.
Which of the following best describes polymorphism?
a)
Ability of a class to derive members of another class as a part of its own definition
b)
Means of bundling instance variables and methods in order to restrict access to certain class member
c)
Focuses on variables and passing of variables to functions
d)
Allows for objects of different types and behaviour to be treated as the same general type
85.
__________ is the problem-solving approach and used where computation is done by using objects.
a)
Procedural programming
b)
Object-oriented programming
c)
Language
d)
Program
86.
is based on normalizing data in the rows and columns of the tables.
a)
Hierarchical
b)
network
c)
relational
d)
Object-Oriented
87.
An advantage of the database management approach is
a)
Data is dependent on programs
b)
Data redundancy increases.
c)
Data is integrated and can be accessed by multiple programs.
d)
None of the above
88.
In which of the following cases a DML statement is not executed?
a)
When existing rows are modified.
b)
When a table is deleted.
c)
When some rows are deleted.
d)
All of the above
89.
What is the full form of SQL?
a)
Structured Query List
b)
Structure Query Language
c)
Sample Query Language
d)
None of these.
90.
What is the full form of SQL?
a)
Structured Query List
b)
Structure Query Language
c)
Sample Query Language
d)
None of these.
91.
The term "TCL" stands for_____.
a)
Ternary Control Language
b)
Transmission Control Language
c)
Transaction Central Language
d)
Transaction Control Language
92.
Which of the following two Python codes will give same output? (i) print(tupl[:-1]) (ii) print(tupl[0:5]) (iii) print(tupl[0:4]) (iv) print(tupl[-4:])
a)
i, ii
b)
ii, iv
c)
i, iv
d)
i, iii
93.
Which of the following creates a tuple?
a)
tuple1=("a","b")
b)
tuple1[2]=("a","b")
c)
tuple1=(5)*2
d)
None of the above
94.
What will be the output of below Python code? list1=[8,0,9,5] print(list1[::-1])
a)
[5,9,0,8]
b)
[8,0,9]
c)
[8,0,9,5]
d)
[0,9,5]
95.
What is the output of the following piece of code? >>> a=(2,3,1,5) >>> a.sort() >>> a
a)
a=(1,2,3,5)
b)
a=(5,3,2,1)
c)
None
d)
Error as tuple is immutable
96.
Read the code shown below carefully and pick out the keys? d = {"john":40, "peter":45}
a)
“john”, 40, 45, and “peter”
b)
“john” and “peter”
c)
40 and 45
d)
d = (40:”john”, 45:”peter”)
97.
What is a variable defined outside a function referred to as?
a)
A global variable
b)
A local variable
c)
A static variable
d)
An automatic variable
98.
What will be the output of the following Python code? def function1(var1=5, var2=7): var2=9 var1=3 print (var1, " ", var2) function1(10,12)
a)
A. 5 7
b)
B. 3 9
c)
C. 10 12
d)
D. Error
99.
If return statement is not used inside the function, the function will return:
a)
None
b)
0
c)
Null
d)
Arbitary value
100.
Where is function defined?
a)
Module
b)
Class
c)
another function
d)
All the above
101.
Python is said to be easily
a)
readable language
b)
writable language
c)
bug-able language
d)
script-able language
102.
Study the following program: a = 1 while True: if a % 7 = = 0: break print(a) a += 1 Which of the following is correct output of this program?
a)
1 2 3 4 5
b)
1 2 3 4 5 6
c)
1 2 3 4 5 6 7
d)
Invalid syntax
103.
Which one of the following has the same precedence level?
a)
Division, Power, Multiplication, Addition and Subtraction
b)
Division and Multiplication
c)
Subtraction and Division
d)
Power and Division
104.
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
105.
Which of the following statements is not correct for variable names in Python language?
a)
All variable names must begin with an underscore.
b)
Unlimited length
c)
The variable name length is a maximum of 2.
d)
All of the above
106.
Which of the following declarations is incorrect in python language?
a)
xyzp = 5000000
b)
x y z p = 5000 6000 7000 8000
c)
x,y,z,p = 5000, 6000, 7000, 8000
d)
x_y_z_p = 5000000
107.
_____ represents an entity in the real world with its identity and behaviour.
a)
A method
b)
An object
c)
A class
d)
An operator
108.
What is the biggest reason for the use of polymorphism?
a)
It allows the programmer to think at a more abstract level
b)
There is less program code to write
c)
The program will have a more elegant design and will be easier to maintain and update
d)
Program code takes up less space
109.
In python, what is method inside class?
a)
attribute
b)
object
c)
argument
d)
function
110.
Which of the following is the most suitable definition for encapsulation?
a)
Ability of a class to derive members of another class as a part of its own definition
b)
Means of bundling instance variables and methods in order to restrict access to certain class member
c)
Focuses on variables and passing of variables to functions
d)
Allows for implementation of elegant software that is well designed and easily modified
111.
Which model data is organized in a tree-like structure.
a)
Hierarchical
b)
network
c)
relational
d)
Object-Oriented
112.
DBMS is stands for_______________
a)
DATABASE MANAGEMENT SQL
b)
DATABASE MANAGEMENT SERVER
c)
DATABASE MANAGEMENT SYSTEM
d)
DATABASE SERVER2000
113.
What is the full form of SQL?
a)
Structured Query List
b)
Structure Query Language
c)
Sample Query Language
d)
None of these.
114.
The term "TCL" stands for_____.
a)
Ternary Control Language
b)
Transmission Control Language
c)
Transaction Central Language
d)
Transaction Control Language
115.
Which of the following provides the ability to query information from the database and insert tuples into, delete tuples from, and modify tuples in the database?
a)
DML(Data Manipulation Language)
b)
DDL(Data Definition Language)
c)
Query
d)
Relational Schema
116.
For what purpose the DML is provided?
a)
Addition of new structure in the database
b)
Manipulation & processing of the database
c)
Definition of the physical structure of the database system
d)
All of the above
117.
What is the output of the following piece of code? >>> a=(2,3,1,5) >>> a.sort() >>> a
a)
a=(1,2,3,5)
b)
a=(5,3,2,1)
c)
None
d)
Error as tuple is immutable
118.
Which of the following is True regarding lists in Python?
a)
Lists are immutable.
b)
Size of the lists must be specified before its initialization
c)
Elements of lists are stored in contagious memory location.
d)
size(list1) command is used to find the size of lists.
119.
Is the following piece of code valid? >>> a=(1,2,3,4) >>> del a
a)
No because tuple is immutable
b)
Yes, first element in the tuple is deleted
c)
Yes, the entire tuple is deleted
d)
No, invalid syntax for del method
120.
What will be the output of below Python code? tuple1=(2,4,3) tuple3=tuple1*2 print(tuple3)
a)
(4,8,6)
b)
(2,4,3,2,4,3)
c)
(2,2,4,4,3,3)
d)
Error
121.
What is the output of the following code? >>> a=(1,2,3,4) >>> del(a[2])
a)
a=(1,2,4)
b)
a=(1,3,4)
c)
a=(3,4)
d)
Error as tuple is immutable
122.
Which of the following function headers is correct?
a)
def fun(a = 2, b = 3, c)
b)
def fun(a = 2, b, c = 3)
c)
def fun(a, b = 2, c = 3)
d)
def fun(a=3, b, c = 3, d)
123.
What is a recursive function?
a)
A function that calls other function.
b)
A function which calls itself.
c)
Both A and B
d)
None of the above
124.
_______ is keyword to do module
a)
export
b)
call
c)
import
d)
include
125.
What is a variable defined inside a function referred to as?
a)
A global variable
b)
A local variable
c)
A static variable
d)
An automatic variable
Reset
