wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CBSE Class 12 Computer Science 2023 Quiz

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What error occurs when you execute the following Python code snippet? apple = mango

a)

ValueError

b)

NameError

c)

TypeError

d)

SyntaxError

2.

Which of the following can be used as valid variable identifier(s) in Python?

a)

global

b)

7Salute

c)

total

d)

Que$tion

3.

Which of the following forces an expression to be converted into specific type?

a)

Explicit type casting

b)

Implicit type casting

c)

Mutable type casting

d)

Immutable type casting

4.

If l=[11,22,33,44], then output of print(len(l)) will be

a)

6

b)

8

c)

3

d)

4

5.

Which point can be considered as difference between string and list?

a)

Indexing and Slicing

b)

Mutability

c)

Accessing individual elements

d)

Length

6.

In python function, the function calling another function is known as_____________and the function being called is known ______________________________

a)

executer, execute

b)

main, keyword

c)

caller, called

d)

called, caller

7.

pow( ) function belongs to which library?

a)

math

b)

string

c)

random

d)

maths

8.

Identify the module to which the following function load () belong to?

a)

math

b)

random

c)

pickle

d)

sys

9.

Which of the following is a valid function name?

a)

All of the above

b)

start-game()

c)

start game()

d)

Start_game()

10.

The variable declared inside the function is called a variable

a)

global

b)

local

c)

external

d)

none of the above

11.

To read the entire remaining contents of the file as a string from a file object myfile, we use

a)

myfile.read()

b)

myfile.readline()

c)

myfile.readlines()

d)

myfile.read(2)

12.

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?

a)

seek( )

b)

bytes( )

c)

fetch( )

d)

tell( )

13.

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()

a)

string, list, list

b)

None, list, list

c)

string, string, list

d)

string, string, string

14.

If a text file is opened in w+ mode, then what is the initial position of file pointer/cursor?

a)

Undetermined

b)

Beginning of file

c)

End of the file

d)

Beginning of the last line of text file

15.

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))

a)

More than or equal to 150

b)

151

c)

Less than or equal to 150

d)

It will always be 150