0% found this document useful (0 votes)
17 views34 pages

P.E Practical

Uploaded by

ykumawat604
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views34 pages

P.E Practical

Uploaded by

ykumawat604
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 34

TSSM'S

Cygnet Public School (N) & Jr. College

Std-XII

Subject- Computer Science

Unit I: Computational Thinking and Programming-2

REVIEW OF PYTHON

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

a) SyntaxError b) NameError c) ValueError d) TypeError

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

a) total b) Salute c) Que$tion d) global

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

a) Implicit type casting b) Mutable type casting

C) Immutable type casting d) Explicit type casting

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

a) Implicit type casting b) Mutable type casting

c) Immutable type casting d) Explicit type casting

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

a)4 b)3 c) 8 d) 6

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

a) Length b) Mutability

c) Indexing and Slicing d) Accessing individual elements

Functions

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

a) main, keyword
b) caller, called

c) called, caller d) executer, execute

Q2: pow( ) function belongs to which library?

a) math b) string c) random d) maths

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

a) math b) random c) pickle d) sys

Q4: Which of the following is a valid function name?

a) Start_game() b) start game() c) start-game() d) All of the above

Q5: The variable declared inside the function is called a variable

a) global b) local c) external d) none of the above

DATA FILE HANDLING

Q1: To read the entire remaining contents of the file as a string from a file object

myfile, we use

a. myfile.read(2) b. myfile.read() c. myfile.readline() d. myfile.readlines()

Q2: 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. tell( ) d. fetch( )

Q3: 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

Q4: If a text file is opened in w+ mode, then what is the initial position of file

pointer/cursor?

a. Beginning of file b. End of the file

c. Beginning of the last line of text file d. Undetermined

Q5: 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. It will always be 150 b. 151

c. More than or equal to 150 d. Less than or equal to 150

BINARY FILES

Q1: Which is the valid syntax to write an object onto a binary file opened in the write

mode?

a. pickle.dump(<object to be written>, <file handle of open file>)

b. pickle.dump(<file handle of open file>, <object to be written>)

c. dump.pickle(<object>, <file handle>)

d. None of the above

REVIEW OF PYTHON

Q1: What error occurs when you execute the following Python code snippet? apple = mango
a) SyntaxError

b) NameError

c) ValueError

d) TypeError

Ans: B

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

a) total

b) Salute

c) Que$tion

d) global

Ans: a
Q3: Which of the following forces an expression to be converted into specific type?

a) Implicit type casting

b) Mutable type casting

c) Immutable type casting

d) Explicit type casting

Ans: D

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

a)4

b)3

c) 8

d) 6
Ans: A

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

Length

Mutability

Indexing and Slicing

Accessing individual elements

Ans: B

Functions

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

a) main, keyword

b) caller, called

c) called, caller
d) executer, execute

Ans: b

Q2: pow( ) function belongs to which library?

a) math

b) string

c) random

d) maths

Ans: a

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

a) math
b) random

c) pickle

d) sys

Ans: c

Q4: Which of the following is a valid function name?

a) Start_game()

b) start game()

c) start-game()

d) All of the above

Ans: a

Q5: The variable declared inside the function is called a variable


a) global

b) local

c) external

d) none of the above

Ans: b

DATA FILE HANDLING

Q1: To read the entire remaining contents of the file as a string from a file object

myfile, we use

a. myfile.read(2)

b. myfile.read()

c. myfile.readline()

d. myfile.readlines()
Ans: b

Q2: 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. tell( )

d. fetch( )

Ans: c

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

Advertisement

y = f.readline()

z = f.readlines()

a. string, list, list

b. None, list, list

c. string, string, list

d. string, string, string

Q4: If a text file is opened in w+ mode, then what is the initial position of file

pointer/cursor?

a. Beginning of file
b. End of the file

c. Beginning of the last line of text file

d. Undetermined

Q5: 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. It will always be 150


b. 151

c. More than or equal to 150

d. Less than or equal to 150

BINARY FILES

Q1: Which is the valid syntax to write an object onto a binary file opened in the write

mode?

a. pickle.dump(<object to be written>, <file handle of open file>)

b. pickle.dump(<file handle of open file>, <object to be written>)

c. dump.pickle(<object>, <file handle>)

d. None of the above

Q2: Rahul is trying to write a tuple t = (10,20,30,40,50) on a binary file

notebook.bin. Consider the following code written by him.

import pickle #statement 1

t = (10,20,30,40,50) #statement 2

myfile = open("notebook.bin",'w') #statement 3

pickle.dump(t, myfile) #statement 4

myfile.close()

Which of the following statement contains an error?

a. Statement 1 b. Statement 2
c. Statement 3 d. Statement 4

Q3: Which among the following is not a function of csv module?

a. reader() b. read() c. writer() d. writerows()

Q4: The opening function of a csv file is similar to the opening of:

a. Binary file b. Text File

c. Both of them d. None of them

Q5: Which mode opens the file for exclusive creation, which fails in the case where file

already exists

a. a b. w c. x d. r

DATA STRUCTURE

Q1: Which list method can be used to perform Pop operation in a stack implemented

by list?

(a) pop() (b) pop(1) (c) remove() (d) pop(0)

Q2: Consider the following operation performed on a stack of size 3, What will be the

output? (* top position)

Puah(10)

Push(20)

Push(30)

Pop()

Push(40)

Push(50)

(a) overflow (b) underflow

(c) 10 20 30 40 50* (d) 10 20 40 50*


Home

articles

CBSE Class 12

CBSE Class 12 Computer Science, 2024 Unit-Wise Important MCQs, Download PDF Here

CBSE Class 12 Computer Science Exam 2024: Download CBSE Class 12 Computer Science Important
MCQs in pdf format. This article will provide essential multiple-choice questions for CBSE Class 12 CS
examination 2024 with answers. Read the complete article for quick revision.

Atul Rawal

By Atul Rawal

Apr 1, 2024, 16:33 IST

Download Unit-wise CBSE Class 12 Computer Science Important MCQs Here

Download Unit-wise CBSE Class 12 Computer Science Important MCQs Here

CBSE Class 12 Computer Science MCQs: Sitting in the examination without proper preparations is like
hitting the target in the dark. It has a higher probability of missing the target. Why take a chance when
you have the time? Let us help you to prepare better for your upcoming computer science exam. Revise
the objective type questions or MCQs. These will be the 1 mark questions and students can use them to
increase their CBSE Class 12 Computer Science score. You will find these in the very initial section of the
paper. Please read the below-mentioned unit-wise important MCQs that will help you in your CBSE Class
12 Computer Science Exam 2024.

Practice Maths

Related Stories

CBSE Class 12 Political Science Sample Paper and Marking Scheme 2024-25: Download Free PDF

50+ Antonyms List for Kids and All Grades School Students
80+ Synonyms List for Kids And All Grades School Students

Unit I: Computational Thinking and Programming-2

REVIEW OF PYTHON

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

a) SyntaxError

b) NameError

c) ValueError

d) TypeError

Ans: B

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

a) total

b) Salute
c) Que$tion

d) global

Ans: a

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

a) Implicit type casting

b) Mutable type casting

c) Immutable type casting

d) Explicit type casting

Ans: D

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

a)4
b)3

c) 8

d) 6

Ans: A

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

Length

Mutability

Indexing and Slicing

Accessing individual elements

Ans: B

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

a) main, keyword

b) caller, called

c) called, caller

d) executer, execute

Ans: b

Q2: pow( ) function belongs to which library?

a) math

b) string

c) random

d) maths

Ans: a
Q3: Identify the module to which the following function load () belong to?

a) math

b) random

c) pickle

d) sys

Ans: c

Q4: Which of the following is a valid function name?

a) Start_game()

b) start game()

c) start-game()
d) All of the above

Ans: a

Q5: The variable declared inside the function is called a variable

a) global

b) local

c) external

d) none of the above

Ans: b

DATA FILE HANDLING

Q1: To read the entire remaining contents of the file as a string from a file object

myfile, we use

a. myfile.read(2)
b. myfile.read()

c. myfile.readline()

d. myfile.readlines()

Ans: b

Q2: 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. tell( )

d. fetch( )

Ans: c
Q3: 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

Ans: c
Q4: If a text file is opened in w+ mode, then what is the initial position of file

pointer/cursor?

a. Beginning of file

b. End of the file

c. Beginning of the last line of text file

d. Undetermined

Ans: a

Q5: 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. It will always be 150

b. 151

c. More than or equal to 150

d. Less than or equal to 150

Ans: d

BINARY FILES

Q1: Which is the valid syntax to write an object onto a binary file opened in the write

mode?

a. pickle.dump(<object to be written>, <file handle of open file>)

b. pickle.dump(<file handle of open file>, <object to be written>)


c. dump.pickle(<object>, <file handle>)

d. None of the above

Ans:a

Advertisement

Q2: Rahul is trying to write a tuple t = (10,20,30,40,50) on a binary file

notebook.bin. Consider the following code written by him.

import pickle #statement 1

t = (10,20,30,40,50) #statement 2

myfile = open("notebook.bin",'w') #statement 3

pickle.dump(t, myfile) #statement 4

myfile.close()
Which of the following statement contains an error?

a. Statement 1

Advertisement

b. Statement 2

c. Statement 3

d. Statement 4

Ans: c

Q3: In which file, no delimiters are used for line and no translations occur?

(a) Text file

(b) Binary file

(c) csv file

(d) None of the above


Ans: b

Advertisement

Q4: Which of the following function is used to read data from a binary file?

(a) write

(b) load

(c) dump

(d) scan

Ans: b

Q5: Choose the file mode used to write data into binary file.

(a) rb
Advertisement

(b) wb

(c) r+

(d) w+

Ans: b

CSV FILE

Q1: The default delimiter for a CSV file is :

a. Semi colon

b. Colon

c. Comma

d. Hyphen

Ans: c
Advertisement

Q2: Which function is used to open a csv file ?

a. Open()

b. csv.open()

c. writer()

d. csv.writer()

Ans:b

Q3: Which among the following is not a function of csv module?

a. reader()

b. read()

c. writer()

d. writerows()
Ans:b

Q4: The opening function of a csv file is similar to the opening of:

a. Binary file

b. Text File

c. Both of them

d. None of them

Ans: b

Read: 10 Best Engineering Institutes in India other than IITs, NITs and IIITs

Q5: Which mode opens the file for exclusive creation, which fails in the case where file

already exists

a. a
b. w

c. x

d. r

Ans: c

DATA STRUCTURE

Q1: Which list method can be used to perform Pop operation in a stack implemented

by list?

(a) pop()

(b) pop(1)

(c) remove()

(d) pop(0)

Ans: a
Q2: Consider the following operation performed on a stack of size 3, What will be the

output? (* top position)

Puah(10)

Push(20)

Push(30)

Pop()

Push(40)

Push(50)

(a) overflow

(b) underflow

(c) 10 20 30 40 50*

(d) 10 20 40 50*

Q3: Choose the correct output for the following stack operation(* top position)
Push(5)

Push(8)

Pop()

Push(2)

Push(5)

Pop()

Push(1)

(a) 8 5 2 5 1*

(b) 8 5 5 2 1*

(c) 2 5 5 1*

(d) 5 2 1*

Q4: Which list method can be used to perform Push operation in a stack implemented

by list?

(a) append() (b) extend()

(c) push() (d) insert()

You might also like