Pt1 Xii Cs Complete in Word

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

KENDRIYA VIDYALAYA PITAMPURA

CLASS – XII A SESSION 2021-22


SUB: COMPUTER SCIENCE
PERIODIC TEST 1
Total Marks:40 Time:90 Min
This paper contains 29 questions.
• Questions numbered from 1 to 15 are of 1 mark each. Select the correct options.
• Questions numbered 16 to 20 are Assertion Reasoning questions.
• Questions number 21 is case study-based question.
• Questions numbered from 22 to 23 are of 1 marks each.
• Questions numbered from 24 to 28 are of 2 marks each.
• Questions number 29 is of 3 marks.
• Programming Language used – Python

SECTION – I (1 MARK QUESTIONS)


1 Which of the following can be used as valid variable/identifiers in Python?
a) 4th Sum
b) Total
c) Number#
d) else
2 Identify the mutable data types?
a) List
b) Tuple
c) int
d) String
3 The correct output will be-
t1=(2,3,4,5,6)
print(t1.index(4))
a) 4
b) 5
c) 6
d) 2
4 What possible output(s) are expected to be displayed on screen at the time of execution of the
program from the following code?
Import random
Ar=[20,30,40,50,60,70]
From =random.randint(1,3)
To=random.randint(2,4)
for k in range(From,To+1):
print(ar[k],end=”#”)

a) 10#40#70#
b) 30#40#50#
c) 40#50#70#
d) 50#60#70#
5. Find the output of the following code?
If name="ComputerSciencewithPython"
Then output of print(name[3:10]) will be-
a) puterSc
b) mputerScie
c) Compute
d) puterScie
6. The Python Library modules which needs to be imported to invoke the ceil() functions:
a) maths
b) random
c) statistics
d) math
7. What will be the correct output among the given options for the following statements?
STR=”VIBGYOR” colors=list(STR)
>>>del colors[4]
>>>colors.remove("B")
>>>colors.pop(3)
>>>print(colors)

a) ‘O’ , ['V', 'I', 'G', 'R']


b) ‘B’ , ['V', 'I', 'G',’Y’, 'R']
c) ‘Y’ , ['V', 'G',’Y’, 'R']
d) ‘O’ , [ 'I', 'G',’Y’, 'R']

8. Which statement is correct for dictionary?


a) A dictionary is an ordered set of key:value pair
b) each of the keys within a dictionary must be unique
c) each of the values in the dictionary must be unique
d) values in the dictionary are immutable

9 Identify the valid declaration of Rec: Rec=(1,‟Vikrant,50000)


a) List
b) Tuple
c) String
d) Dictionary

10 Which of the following is valid arithmetic operator in Python:


a) //
b) ?
c) <
d) And

11 Function can alter only Mutable data types?


(a) True
(b) False)

12 Suppose a tuple Tup is declared as Tup = (12, 15, 63, 80), which of the following is incorrect?
a) print(Tup[1])
b) Tup[2] = 90
c) print(min(Tup))
d) print(len(Tup))

13 The built-in mathematical function / method that is used to return square root of a number-
a) Squareroot()
b) Sqrt()
c) Square()
d) Root()

14 Which keyword is used to access a global variable inside the function, if function has a
variable with same name?
a) Nonlocal
b) def
c) args
d) global
15 The area of program where a variable has a valid value is called ______
a) Life time
b) Scope
c) Parameter
d) Global area

Assertion Reasoning type questions


Directions: in the following questions, a statement of assertion is followed by a statement
of reason
Mark the correct choices as A or B or C or D

16. Assertion Statement (A): Integer is mutable datatype.


Reason (R): The value of integer variable cannot be changed.
A. A is True but R is False
B. A is False but R is True
C. Both A and R are False
D. Both A and R are True
17. Assertion Statement (A): List has indices to access the elements.
Reason (R): The list is an ordered data type.
A. A is True but R is False
B. A is False but R is True
C. Both A and R are True and R is correct explanation of A
D. Both A and R are True and A is correct explanation of R
18 Assertion Statement (A): range(10,15) would generate 5 number.
Reason (R): Both upper and lower limits of the list are included.
A. Both A and R are True
B. A is True but R is False
C. A is False but R is True
D. Both A and R are False
19 Assertion Statement (A): Break statement changes in normal flow of execution.
Reason (R): Break statement terminates the current loop.
A. Both A and R are true and R is the correct explanation of A.
B. Both A and R are true but R is not the correct explanation of A.
C. A is True but R is False
D. A is False but R is True
20 Assertion Statement (A): 'w' in 'hello' results in False.
Reason (R): Length of 'w' is less than length of 'hello'
A. Both A and R are true and R is the correct explanation of A.
B. Both A and R are true but R is not the correct explanation of A.
C. A is True but R is False
D. A is False but R is True
CASE STUDY BASED QUESTIONS
21 Vivek is looking for his dream job but has some restrictions. He loves Delhi and would take a
job there if he is paid over Rs.40,000 a month. He hates Chennai and demands at least Rs.
1,00,000 to work there. In any another location he is willing to work for Rs. 60,000 a month. The
following code shows his basic strategy for evaluating a job offer. Code: 5
pay= _________
location= _________
if location == "Mumbai":
print ("I’ll take it!") #Statement 1
elif location == "Chennai":
if pay < 100000:
print ("No way") #Statement 2
else:
print("I am willing!") #Statement 3
elif location == "Delhi" and pay > 40000:
print("I am happy to join") #Statement 4
elif pay > 60000:
print("I accept the offer") #Statement 5
else:
print("No thanks, I can find something better") #Statement 6

On the basis of the above code, choose the right statement which will be executed when
different inputs for pay and location are given.
i) Input: location = "Chennai”, pay = 50000
a. Statement 1
b. Statement 2
c. Statement 3
d. Statement 4
ii) Input: location = "Surat" ,pay = 50000
a. Statement 2
b. Statement 4
c. Statement 5
d. Statement 6
iii) Input- location = "Any Other City", pay = 1
a Statement 1
b. Statement 2
c. Statement 4
d. Statement 6
iv) Input location = "Delhi", pay = 500000
a. Statement 6
b. Statement 5
c. Statement 4
d. Statement 3
v) Input- location = "Lucknow", pa y = 65000
a. Statement 2
b. Statement 3
c. Statement 4
d. Statement 5
SECTION - II
(1 MARKER QUESTIONS)
22. What is the output of the below program? (1)
def say(message, times = 1):
print(message * times)
say('Hello')
say('World', 5)

23. Declare a dictionary Color, whose keys are 1, 2, 3 and values are Red, Green and Blue
respectively. (1)
(2 MARKER QUESTIONS)

24. What is the difference between actual and formal parameters? Explain with example.(2)
25. Observe the following Python code very carefully and rewrite it after removing all syntactical
errors with each correction underlined. (2)
DEF execmain():
x = input("Enter a number:")
if (abs(x)=x):
print ("You entered a positive number")
else:
x=*‐1
print "Number made positive:"x
execmain()

26. What will be the output of following code? (2)


X = 80
def one(num1):
global X
num1 += X
X += 20
num1 = two(num1)
return num1
def two(num1):
global X
num1 += X
X += 10
num1 = three(num1)
return num1
def three(num1):
X = 200
num1 += X
return num1
num = 200
num = one(num)
print(num, X)

27. If given A=2,B=1,C=3, What will be the output of following expressions: (2)
(i) print((A>B) and (B>C) or(C>A))
(ii) print(A**B**C)
28. What will be the output of following code: (2)
def Alter(x, y = 10, z=20):
sum=x+y+z
print(sum)
Alter(10,20,30)
Alter(20,30)
Alter(100)

(3 MARKER QUESTIONS)
29. Write a function listchange(Arr) in Python, which accepts a list Arr of numbers, the function
will replace the even number by value 10 and multiply odd number by 5 . (3)
Sample Input Data of the list is:
a=[10, 20, 23, 45]
listchange(a) output : [10, 10, 115, 225]
**********ALL THE BEST ***********

You might also like