Comp QP

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

SPRINGDAYS (CBSE)

SENIOR SECONDARY SCHOOL


CLASS - XII TIME: 90 Min.
DATE: 7.10.2021 Total Marks: 35
NAME JonAN REVISION EXAM11
COMPUTER SCIENCE (CODE-083)
General Instruetions:
The paper is divided into 3 Sections- A, B and C.
Section A., consists of Questionl to 25 and student need to attempt 20 questions.
Section B, consists of Question number 26 to 49 and student need to attempt 20 questions.
Section C. consists of Question number 50 to 55 and student need to attempt 5 questions.
All questions carry equal marks.

SECTION-A
(Attempt any 20 questionsS)
(1. Which of the following is not considered a valid identifier in Python?
a) Two2 b)main c) hello_rspl 2 hundred
2. What will be the output of the following code?
print(100+200")
a)300 b) 100200 100+200 d) 200
3. pow Aunction belongs to which library ?
amath b) string c) random d) maths
4. What is the output of the following?
x= 123
for i in x:
print(i)
a 123 b) 123 C) error d) infinite
S. What data type is the object below?
L1, 23. 'hello',1
list b) dictionary c) array d) tuple
.What is the value of this expression 3**3**1?
A27 b) 9 c) 3 d) 1
TList AL is defined as follows:
AL-[1,2,3,4,5]
Which of the following statement/statements removes the middle element 3 from it so that the list
ALequals [1,2,4,5]?
del al2]1 b) a[2:3] = [1
c)a[2:2]=I] Both a and b
8Find the valid identifier from the following
a) False b) Ist&2nd c)2ndName d) My_Name
9.Given the lists L=[1,30,67,86,23,15,37,131,9232] , write the õutput of print(L[3:7])
a) [67,86,23,15,37] T86,23,15,37] c)ERROR d) None of the above
10. dentify the invalid logical operator in Python from the
following.
a ) and b) or c)not dBoolean
11/Suppose a tuple T is declared as T= (10, 12, 43, 39), which of the following is Incorrect?
a print( 1T[I]) b) print(max(T)) ) print(len(T)) d) None of the these

1
12)A list is declared as
Lst [1.2.3.4.5,6.8)
What will be the value of sum(Lst)?
b) 30 c) 7 d) 8
a) 29
13. Ifthe following code is executed. what will be the output of the following eode?
name="Computer_Science_with_Python"
print(name[-25:10])
a}púler_S b) hon c) puter_Science d) Science
4/Can tuple be nested?
a) Yes b) No
15. Can we modify/change keys of a dictionary ?
C a) Yes b) No
16... ..method of list is used to delete a given element from the list.
a del b)extend() C)remove() d)append()
(17.A tuple is declared as
T (2.66,77.55,6.9,55.8)
Write the output of
print(T.index(55))
a) 4 b}3 c) 55 d) None of these.
18. Which of the following is/are valid declaration of a dictionary?
a D = {'StuName': 'Alan', 'StuAge': 30, 'StuCity': 'Vizag'}
b) D = ['StuName': "Alan', 'StuAge': 30, 'StuCity': 'Vizag']

c)D= (StuName': 'Alan', 'StuAge: 30, 'StuCity': Vizag)


d) D {'StuName'; 'Alan', 'StuAge': 30, 'StuCity': 'Vizag'
19.Nf the following code is executed, what will be the output of the following code?
VTitle="Online Teaching 2020"
print(Title[6:10], Title[-2:-4:-1]) c) e Tea 02
a Pea 20
b Erro d) Online
20.)Write the output of the following python expression:
print((4>5) and (2!=1) or (4<9))
) False (i) True
21/Which of the following is the use of function in python?
a Functions are reusable pieces of programs
b) Functions don't provide better modularity for your application
c) you can't also create your own functions

d) All of the mentioned


in
22. Which are the advantages of functions python?
a) Reducing duplication of code
b) Decomposing complex problems into simpler pieces
c)Improving clarity of the code
dAll of the mentioned
What is a variable defined outside a function referred to as?
a) A static variable b) A global variable

c) A local variable d) An automatic variable


(24,/How are variable length arguments specified in the function heading?
a) one star followed by a valid identifier
b) one underscore followed by a valid identifier
c) two stars followed by a valid identifier
d) two underscores followed by a valid identifier
5. What is the value returned by math.floor(3.4)?
93 b) 4 c) 4.0 d) 3.0

SECTION -B
(Attempt any 20 questions)
(26 What is the output when we execute list("hello")?
a )a) [h', 'e', T, T, o'] b) 'hello'] c)[llo'] d) 'olleh']
27. Suppose listl is [2445,133.12454, 123], what is max(list1)?
)2445 b) 133 T2454 d) 123
(28 Suppose listl is [2, 33, 222, 14, 25]. What is
listl[-1]?
a) Error b) None 25 d) 2
29/Suppose listl is [2, 33, 222, 14, 25]. What is list1[:-1]?
2 , 33, 222, 14] b) Error c)25 h [25, 14, 222, 33, 2]
G2To add a new element to a list we use which command?
a listl.add(5) istl.append(5). c)list1.addLast(5) d) listl.addEnd(5)
31. To insert 5 to the third
position list1,
in which command?
we use
a) list1.insert(3, 5) b) list1.insert(2, 5) c)listl.add(3, 5) dHistl.append(3, 5)
(32. Suppose listl is [3, 4, 5, 20, 5], what is listl.index(5)?
b) 1 )4 d2
33.Suppose listExample is [3, 4, 5, 20, 5, 25, 1,3], what is listl after listExample.extend ([34, 5])?
a13,4, 5, 20, 5, 25, 1,3, 34, 5] b) [1, 3,3, 4, 5, 5, 20, 25, 34, 5]
¢) [25, 20. 5, 5, 4, 3, 3, 1, 34, 5]
d) [1, 3, 4, 5, 20, 5, 25, 3, 34, 5]
34.Suppose listEx is [3, 4, 5. 20, 5, 25, 1, 3], what is listl after listEx.pop()?
a13, 4, 5, 20, 5, 25, 1] b) [1,3,3, 4, 5, 5, 20, 25]
e) 3, 5, 20, 5, 25, 1, 3] d) [1, 3, 4, 5, 20, 5, 25]
35. Suppose d = {"john":40, *"peter":45}, to delete the entry for "john" what command do we use?

a)ddelete("john":40)b) b) delete("john")
edel d["john"] d) del d("john":40)
[36. What is the output of the following code?
a=10
b-20
def change():
global b
a-45
b-56
change()
print(a)
print(b)
a10 and 56 b45 and 56 c)10 and 20 d)Syntax Error
37 phe output of the code shown below is:
lef fl():
x=15
print(x)
x=12
fi0
a) Error b) 12 d) 1512
(38, What is the output of the code shown below?
x=100

def f10:
3
global x
x=90

def f20
global x
x=80
print(x)
a) 100 b)90 80 d) Error
(39 Study the following program ánd select the possible outputs from the option (a) to (d) following
it.
import random
xrandom.random()
y=random.randint(0,4)
Print(int(x0, " :", y + i n t ( x ) )

t a ) 0: 0
b)1:6 c)2:4 d) ERROR
40.,0bserve the code carefully and write answer of questions given below
def sum(a-5,b=6,c-9):
print(a,b.c)
sum(1,2.3)
What is the output of the above code?
a ) 123
569 c) 6812 d) None of the above
Say s="hello" what will be the return value of type(s)?
a)
int b) bool c) str
(42. What is "Hello".replace("l", "e")? String
aHeeeo b) Heelo c) Heleo d) None
43.Suppose listl is [3, 4, 5, 20, 5, 25, 1,3], what is list1.count(5)?
a) 0 b) 4 c)1
44./What will be displayed by print(ord( b') - ord('a'))?
d2
a) 0 b) 1 c)-1 d) 2
$45. What will be the output of the following Python code?
print("abcDEF".capitalize)
a) abc def b)ABC DEF c) Abc def d) Abc Def
*46. What will be the output of the following Python code?
print('a B .isalpha())
aTrue b) False c) None d) Error
What will be' the output ofthe following Python code snippet?
print('mystring'.isidentifier))
True b) False c) None d) Error
48. What will be the output of the following Python code?
print(xyxxyyZXxy Istrip('xyy'))
a) ZXxy b) xyxxyyzXxy xyxzXXxy d) none of the mentioned
49.What will be the output of the following Python code snippet?
print('abcdef12'.replace('cd','12')
a)ab12ef12 b) abcdef12 c) abl2efcd d) none of the mentioned

SECTION-C
(Attemptany 5 questions)
Consider the folowing code and answer the questions that follow:
Book={1:"Thriller, 2:Mystery', 3:Crime', 4:Children Stories'
Library={'5 Madras Diaries,6':'Malgudi Days'
4
to °Crime Thriller'. He
Ramesh needs to change the title in the dictionary book from "Crime'
has writen the following command:
Book['Crime']=Crime Thriller'
command:
But he is not getting the a nswer. Help him choose the correct
a. Book[2]=Crime Thriller' Book[3]='Crime Thriller
c. Book[2]-(Crime Thriller) Book[3=Crime Thriller)
Book with Library the command would be:
51. The command to merge the dictionary
ad=Book+Library b. print(Book+Library)
c. Book.update(Library) d. Library.update(Book)
52. What will be the output of the following
line of code:
print(list(Library))
a. ['5', Madras Diaries', 6°', Malgudi Days]
b. ('5','Madras Diaries', '6','Malgudi Days')
Madras Diaries, Malgudi Days']
d. ['5',6 uses the
in the dictionary Book, Ramesh
53. In order to check whether the key 2 is present
following command:
2 in Book
"True'. Now to check whether the name 'Madras Diaries' exists in the
He gets the answer

dictionary Library, he uses the following command:


Madras Diaries' in Library
s w e r as "False'. Select the correct reason for this:
But hegets theusea nthe
a. We cannot in function with values. It can be used with keys only.
with the in operator
b. We must use the function Library.values) along
function instead of the in operator
c. We can use the Library.items()
e B o t h b and c above are correct.
code
54. With reference to the above declared
dictionaries, predict the output of the following
fragment-
Library=Book
Library.pop(2)
print(Library)
print(Book)
a)
3: 'Crime', 4: 'Children Stories'}
{1: 'Thriller, 2: 'Mystery',
3: 'Crime', 4: 'Children Stories'}
{1: Thriller, 2: 'Mystery',

b)
{2:Mystery'}
{1: "Thriller', 2: 'Mystery', 3: 'Crime', 4: 'Children Stories'}

c)
{1: Thriller, 3: 'Crime', 4: 'Children Stories'}
{1:'Thriller', 3: 'Crime', 4: 'Children Stories'}

{1: Thriller, 3: 'Crime', 4: 'Children Stories)


1: Thriller, 2: Mystery, 3: 'Crime', 4: 'Children Stories'
55.With reference to the above declared dictionaries. predict the output of the following code
fragment-
Library=Book.copy()
Library.pop(2)
print(Library)
print(Book)
a)
{1: Thriller', 3: 'Crime', 4: '"Children Stories'
{1: Thriller, 3: 'Crime', 4: 'Children Stories'}

b)
1: 'Thriller, 3: 'Crime', 4: Children Stories'}
{1: Thriller, 3: 'Crime', 4: 'Children Stories'}

1: Thriller, 3: 'Crime',4: 'Children


Stories'}
{1: Thriller', 2: 'Mystery', 3: 'Crime', 4: 'Children Stories'}
d)
{Thriller, 3: 'Crime', 4: 'Children Stories'}
Thriter, 3: Crime', 4: 'Children Stories'}

You might also like