CBSE-CLASS-XII SERIES
Computer-science

Commands And Requests

11 previous year questions.

Volume: 11 Ques
Yield: Medium

High-Yield Trend

11
2024

Chapter Questions
11 MCQs

01
PYQ 2024
medium
computer-science ID: cbse-cla
State True or False:
While defining a function in Python, the positional parameters in the function header must always be written after the default parameters.
02
PYQ 2024
medium
computer-science ID: cbse-cla
Write a user-defined function in Python named showInLines() which reads contents of a text file named STORY.TXT and displays every sentence in a separate line. Assume that a sentence ends with a full stop (.), a question mark (?), or an exclamation mark (!). Example:
If the content of the file STORY.TXT is:
Our parents told us that we must eat vegetables to be healthy. And it turns out, our parents were right! So, what else did our parents tell?
Then the function should display:
Our parents told us that we must eat vegetables to be healthy.
And it turns out, our parents were right!
So, what else did our parents tell?

03
PYQ 2024
medium
computer-science ID: cbse-cla
Predict the output of the following code:
def callon(b=20, a=10): b = b + a a = b - a print(b, "#", a) return b x = 100
y = 200
x = callon(x, y)
print(x, "@", y)
y = callon(y)
print(x, "@", y) 
04
PYQ 2024
medium
computer-science ID: cbse-cla

A tuple named subject stores the names of different subjects. Write the Python commands to convert the given tuple to a list and thereafter delete the last element of the list.

05
PYQ 2024
medium
computer-science ID: cbse-cla

Write a user-defined function in Python named showGrades(S) which takes the dictionary S as an argument. The dictionary S contains Name: [Eng, Math, Science] as key:value pairs.
The function displays the corresponding grade obtained by the students according to the following grading rules:



Example: Consider the following dictionary: The output should be:

06
PYQ 2024
medium
computer-science ID: cbse-cla
Expand the following terms:
XML, PPP Give one difference between circuit switching and packet switching.
07
PYQ 2024
medium
computer-science ID: cbse-cla

Consider the following Python statement:
F = open('CONTENT.TXT')
Which of the following is an invalid statement in Python?

1

F.seek(1, 0)

2

F.seek(0, 1)

3

F.seek(0, -1)

4

F.seek(0, 2)

08
PYQ 2024
medium
computer-science ID: cbse-cla
State whether the following statement is True or False:
While handling exceptions in Python, name of the exception has to be compulsorily added with except clause.

09
PYQ 2024
medium
computer-science ID: cbse-cla
Question: Select the correct output of the following code:

event = "G20 Presidency@2023"
L = event.split(' ')
print(L[::-2]) 
1

'G20'

2

'Presidency@2023'

3

'G20'

4

'Presidency@2023'

10
PYQ 2024
medium
computer-science ID: cbse-cla
Identify the invalid Python statement from the following:
1

d = dict()

2

e = {}

3

f = []

4

g = dict{}

11
PYQ 2024
medium
computer-science ID: cbse-cla
The slicing operations in the given code work as follows:
  • myStr[:4] extracts the first 4 characters, which are "MISS".
  • myStr[-5:] extracts the last 5 characters, which are "SIPPI".
  • These two substrings are concatenated with a "#" in between, resulting in "MISS#SIPPI".
1

YELLOW # RED #

2
RED # GREEN #
3

GREEN # RED #

4

YELLOW # GREEN #