NEW
Font size
WorksheetsCBSE Class 12 Computer Science 2023 Quiz
Total questions: 15
Worksheet time: 8mins
What error occurs when you execute the following Python code snippet? apple = mango
ValueError
NameError
TypeError
SyntaxError
Which of the following can be used as valid variable identifier(s) in Python?
global
7Salute
total
Que$tion
Which of the following forces an expression to be converted into specific type?
Explicit type casting
Implicit type casting
Mutable type casting
Immutable type casting
If l=[11,22,33,44], then output of print(len(l)) will be
6
8
3
4
Which point can be considered as difference between string and list?
Indexing and Slicing
Mutability
Accessing individual elements
Length
In python function, the function calling another function is known as_____________and the function being called is known ______________________________
executer, execute
main, keyword
caller, called
called, caller
pow( ) function belongs to which library?
math
string
random
maths
Identify the module to which the following function load () belong to?
math
random
pickle
sys
Which of the following is a valid function name?
All of the above
start-game()
start game()
Start_game()
The variable declared inside the function is called a variable
global
local
external
none of the above
To read the entire remaining contents of the file as a string from a file object myfile, we use
myfile.read()
myfile.readline()
myfile.readlines()
myfile.read(2)
Which function of a file object can be used to fetch the current cursor position in terms of number of bytes from beginning of file?
seek( )
bytes( )
fetch( )
tell( )
For the following python code, what will be the datatype of variables x, y, z given that the code runs without any error? f = open(‘story.txt’) x = f.read(1) y = f.readline() z = f.readlines()
string, list, list
None, list, list
string, string, list
string, string, string
If a text file is opened in w+ mode, then what is the initial position of file pointer/cursor?
Undetermined
Beginning of file
End of the file
Beginning of the last line of text file
What will be the most correct option for possible output of the following code, given that the code executes without any error. f = open(‘cricket.txt’) data = f.read(150) print(len(data))
More than or equal to 150
151
Less than or equal to 150
It will always be 150
