Worksheetspython_quiz
Total questions: 25
Worksheet time: 13mins
Which of the following is not a feature of Python?
High Level Language
Open Source
Compiled
None of the above
What among the following is true about scripting language?
It use interpreter to translate source code into executable code
Scripting executes instructions one by one
Python is a scripting language
All of the above
Which of the following is not true?
python is dynamic typed language
there is no datatype in python
type of data is automatically detected
None of the above
If we write string in triple quote, it is called ________
multiline comment
docstring
string array
none of the above
What is the significance of the global keyword?
It makes local variable as global
It indicates to use global version of variable instead of creating local copy
It converts local variable to global variable
none of the above
What is true about pass statement?
It is used to have statement inside the block but do nothing
It will create Empty Block without any executable Statement
Pass statement do nothing
All of the above
Which of the following is not a loop in python?
while
for
do .. while
none of the above
What is the output of the following code?
for i in range(1,10,2):
print(i+1,end=' ')
2 4 6 8
2 4 6 8 10
1 3 5 7 9 11
1 3 5 7 9
if L = [ ], then what L can be ?
Syntax Error
Empty Array
Empty Tuple
Empty List
When you pass an array as an argument to a function in C, what actually gets passed?
values of the elements of the array
address of the first element of the array
number of elements of the array
none of the above
How many book titles you can store properly if a 2-D array is declared as char title[10][15] in C?
10
15
9
Error
State true or false. The C Structure stores homogeneous type of elements.
True
False
Which of the following data types is immutable in Python?
Set
Dictionary
List
Tuple
What will be the output of the following code?
print('Hello' + ' World')
HelloWorld
Error
None of the above
Hello World
Which of the following is a valid way to create a function in Python?
myFunction() = def:
def myFunction():
function myFunction():
def myFunction[]:
Which of the following is the correct way to declare a variable in Python?
int myVariable = 10
myVariable = 10
myVariable: int = 10
var myVariable = 10
What will be the output of the following code?
for i in range(5):
print(i*2,end=' ')
0 2 4 6
0 2 4 6 8
0 1 2 3 4
1 3 5 7 9
Which of the following is a characteristic of a list in Python?
Lists can contain mixed data types
Lists cannot be nested
Lists are immutable
Lists are fixed in size
What is the output of the following code?
for i in range(3):
print(i**2,end=' ')
0 1 4
1 4 9
0 1 2
1 2 3
Which of the following is a mutable data type in Python?
Integer
List
Tuple
String
What will be the output of the following code?
print('Python' * 3)
3 Python
PythonPythonPython
Python 3
Error
What is the output of the following code?
print('Hello' * 2)
Error
None of the above
Hello Hello
HelloHello
Which of the following is a valid way to create a list in Python?
list myList = []
myList = list()
myList: list = []
list myList[]
What will be the output of the following code?
for i in range(4):
print(i*3,end=' ')
1 2 3 4
0 1 2 3
0 3 6
0 3 6 9
What does Python string slicing s[:] means if s is an object of string?
fetches items at offsets 0 through the end
fetches items at offset 1 through the end (the sequence length).
fetches items at offset 1 up to but not including last item.
fetches items at offset 0 up to but not including the last item.
