KMS Computer Science Xii 2
KMS Computer Science Xii 2
General Instruction:
General Instructions:
The question paper is divided into 3 Sections - A, B and C.
Section A, consist of 25 Questions (1-25). Attempt any 20 questions.
Section B, consist of 24 Questions (26-49). Attempt any 20 questions.
Section C, consist of 6 case study based Questions (50-55). Attempt any 5 questions.
All questions carry equal marks.
SECTION A
Question: Vishal is a software developer with a reputed firm. He has been given
the task to computerize the operations for which he is developing a firm which will
accept customer data as follows: The data to be entered is: Name, Age, Items
Bought, Total Amount.
Q.1 Choose the most appropriate data type to store the above information in the
given sequence.
a. string, tuple, float, integer b. string, integer, dictionary, float
c. string, integer, integer, float d. string, integer, list, float
Q.2 Now to calculate total bill amount of customers, Vishal can use which data
type to store the sum.
a. Integer b. Float c. List d. Tuple
Q.3 Vishal wants to update name of the customer in list. Which function from the
given options can be used?
L=[“Mayank”, 18]
a. L[0]= “Ajay” b. update(“Ajay”)
c. L[1]= “Ajay” d. L[0]=update(“Ajay”)
Question :
print("Enter Marks Obtained in 5 Subjects: ")
markOne = int(input())
markTwo = int(input())
markThree = int(input())
markFour = int(input())
Page | 1
markFive = int(input())
tot = markOne+markTwo+markThree+markFour+markFive
avg = tot/5
if avg>=91 and avg<=100:
print("Your Grade is A1") #Statement 1
elif avg>=81 and avg<91:
print("Your Grade is A2") #Statement 2
elif avg>=71 and avg<81:
print("Your Grade is B1") #Statement 3
elif avg>=61 and avg<71:
print("Your Grade is B2")
elif avg>=51 and avg<61:
print("Your Grade is C1")
elif avg>=41 and avg<51:
print("Your Grade is C2")
elif avg>=33 and avg<41:
print("Your Grade is D")
elif avg>=21 and avg<33:
print("Your Grade is E1")
elif avg>=0 and avg<21:
print("Your Grade is E2")
else:
print("Invalid Input!") #Statement 4
On the basis of the above code, choose the correct option which will be executed
when different inputs are given.
Q.4 If markOne, markTwo, markThree, markFour=100,97,82,85 and
markFive = “Nil” then total will be
a. 364 b. 0 c. Syntax Error d. TypeError
Page | 2
Q.8 If avg=81, then which statement will execute.
a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4
Question : Naman prepare a code for different conditions and take different inputs
in variable str1. What will be the output for the different inputs given below:
str1=" "
str2=""
I=0
while I<len(str1):
if str1[I]>="A" and str1[I]<="M":
str2=str2+str1[I+1]
elif str1[I]>="0" and str1[I]<="9":
str2=str2+str1[I-1]
else:
str2=str2+"*"
I=I+1
print(str2)
def display(a):
a1=""
for i in range(0,len(a)):
if(a[i].isspace()):
a1=a1+"*"
elif(a[i].isdigit()):
a1=a1+"&"
elif(a[i].isalpha()):
a1=a1+a[i].upper()
print(a1)
display(" ")
Page | 3
Question : Assume, you are given two lists: a = [1,2,3,4,5] b = [6,7,8,9]
The task is to create a list which has all the elements of a and b in one dimension.
Q.14 What will be the output for the given statement, if you enter 9
a=b=int(input(“Enter any number : “)) print(a,b)
a. 9,9 b. 9 9 c. error d. 0 9
Question: Suppose you are defining a tuple given below: tup = (1, 2, 3, 4, 5)
Q.19 You want to update the value of this tuple at 2nd index to 10. Which of the
following option will you choose?
a. tup(2) = 10 b. tup[2] = 10 c. tup{2} = 10 d. None of these
Q.20 You want to check the index of value 5. Which of the following option will
you choose?
a. tup.index(5) b. tup=index(5) c. tup.index(4) d. tup=index(4)
Q.21 You want to check the minimum value of tup. Which of the following option
will you choose?
Page | 4
a. min=tup() b. tup=min(1) c. tup=min() d. min(tup)
Q.22 You want to check the length of tup. Which of the following option will you
choose?
a. len.tup b. len(tup) c. len=tup d. None of these
Q.23 You want to delete tup. Which of the following option will you choose?
a. delete(tup) b. remove(tup) c. del tup d. tup.remove()
Q.24 What will be the output for the following Python statement
print([1,2,3,4,5]+5)
a. [6,7,8,9,10] b, [1,2,3,4,5,5] c, Error d. None of these
Q.25 What will be the output for the following Python statement print([1,2,3]*[3])
a. [3,6,9] b, [1,2,3,3] c, Error d. None of these
SECTION B
Q.27 Which of the following function calls will cause Error while invoking/calling
the below function definition?
def test(a,b,c,d):
a. test(1,2,3,4) b. test(4,5,6,7)
c. test(a=1,b=2,c=3,d=4) d. test(a=1,2,3,4)
Q.28 Which of the following function calls can be used to invoke/calling the below
function definition?
def test(a,b,c,d)
a. test(1,2,3,4) b. test(2,3,4)
c. test(a=1,b=2,c=3,4) d. test(1,b=2,3,d=4)
Q.29 What is a variable defined outside all the function referred to as?
a. A static variable b. A global variable
c. A local variable d. An automatic variable
Page | 5
Q.31 What will be the output of the following python code:
a=10
def call():
global a
a=15
b=20
call()
print(a)
Page | 6
Q.36 What will be the output of following code:
def func(a=10,b=20):
return a+b
print(func(a=1,b=2))
Q.38 What will be the output of the following expression: >>> 5//20
a. 5 b. 20 c. 4 d. 0
Q40. Which of the following statement is False regarding the opening modes of a
file?
(a) When you open a file for reading, if the file does not exist, an error occurs.
(b) When you open a file for reading, if the file does not exist, the program will
open an empty file.
(c) When you open a file for writing, if the file does not exist, a new file is created.
(d) When you open a file for writing, if the file exists, the existing file is overwritten
with the new file.
Page | 7
(a) ['C', 'C++', 'VB', 'FORTRAN'] (b) ['C', 'C++', 'Python', 'FORTRAN']
(c) ['C', 'C++', 'BASIC', 'FORTRAN'] (d) ['C', 'C++', 'Python', 'BASIC']
Q48. Which of the following file format will be fast in read and write operation?
a. Text file b. CSV file c. Binary file d. None of these
Q49. Which of the following file mode constant helps to retain the file content
during a file write operation?
a. „w‟ b. „r‟ c. „a‟ d. None of these
SECTION C
53. Fill in the blank in statement-4, which display the name having exactly 5
characters.
(a) namelist (b) name (c) length (d) None of these
55. Fill in the blank in Statement-6 to call the function with NList.
(a) FindNames() (b) FindNames(NList) (c) print(FindNames())
(d) print(FindNames(NList)
Page | 9