0% found this document useful (0 votes)
88 views9 pages

KMS Computer Science Xii 2

The document provides details about a Computer Science exam including general instructions, sections and sample questions. It mentions the exam has 3 sections (A, B and C) with Section A containing 25 multiple choice questions to attempt any 20, Section B containing 24 multiple choice questions to attempt any 20, and Section C containing 6 case study based questions to attempt any 5. Sample questions provided relate to data types, functions, conditionals, loops and functions in Python.

Uploaded by

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

KMS Computer Science Xii 2

The document provides details about a Computer Science exam including general instructions, sections and sample questions. It mentions the exam has 3 sections (A, B and C) with Section A containing 25 multiple choice questions to attempt any 20, Section B containing 24 multiple choice questions to attempt any 20, and Section C containing 6 case study based questions to attempt any 5. Sample questions provided relate to data types, functions, conditionals, loops and functions in Python.

Uploaded by

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

Class – XII – Term 1 Examination 2021

Computer Science (083)

Max Marks: 35 Times Allowed: 90 Minutes

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

Q.5 If avg= “Nil” then which statement will execute.


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

Q.6 If markOne,markTwo,markThree,markFour,markFive=100,95,90,80,85 then


which statement will execute.
a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4

Q.7 If markOne,markTwo,markThree,markFour,markFive=100,83,92,80,100 then


which statement will execute.
a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4

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)

Q.9 If input will be str1= “Exam2021” then output will be


a. X***M202 b. X**M2021
c. x***m201 d. x***m202

Question : If a user change its passing parameter of function calling display( ).


What will be the output of the following code.

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(" ")

Q.10 If passing parameter will be “Exam2021”, then output will be


a. Exam&&&& b. EXAM**** c. EXAM&&&& d. Exam****

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.11 If Output : a = [1,2,3,4,5,6,7,8,9] , Which of the following option would


you choose?
a. a.append(b) b. a.extend(b) c. Any of the above d. None of these
Q.12 If Output : a = [1,2,3,4,5,[6,7,8,9]] , Which of the following option would
you choose?
a. a.append(b) b. a.extend(b) c. Any of the above d. None of these

Q.13 Which of the following is not a token


a. Keywords b. Punctuators c. Operators d. comments

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

Q.15 function we can use to check the value of a variable


a. id() b. type() c. print() d. None of these

Q.16 …………….. of the dictionary must be unique.


a. Value b. Key c. None of these d. All of these
Q.17 To create an empty dictionary D={} and D=dict()
a. Both are true b. First one true c. Both are false d. Second one
false
Q.18 A variable can have following properties id, value and type
a. True b False

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.26 Which of the following function headers is correct?


a. def f(a=1,b): b. def f(a=1,b,c=2):
c. def f(a=1,b=1,c=2): d. def f(a=1,b=1,c=2,d):

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

Q.30 What is a variable defined inside a 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)

a. 15 b. 20 c. None d. None of these

Q.32 What is the output of the following code?


a=10
def func():
a=20
func()
print(a)
a. 10 b. 20 c. None d. None of these

Question : Consider the following python code:


def Add(x,y,z):
print(x+y+z)
Add(10,20,30) #Invoke 1
Add(x=20,y=40,z=60) #Invoke 2

Q.33 Which type of argument used in #Invoke 1?


a. Positional Argument b. Default Argument
c. Keyword Argument d. Variable length Argument

Q.34 Which type of argument used in #Invoke 2?


a. Positional Argument b. Default Argument
c. Keyword Argument d. Variable length Argument
Q.35 What will be the output of following code:
def func(a=10,b=20):
return a+b
func(a=1,b=2)

a. 30 b. 3 c. No Output d. None of these

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

a. 30 b. 3 c. No Output d. None of these

Q.37 What will be the output of the following code:


def calc(x):
r=2*x**2
return r
print(calc(2))
a. 8 b. 16 c. 20 d. No output

Q.38 What will be the output of the following expression: >>> 5//20
a. 5 b. 20 c. 4 d. 0

Q.39 What will be the following code produce?


T=[„dps‟,‟shj‟]
T1=range(len(T))
for i in T1:
T[i]=T[i].upper()
print(T)
a)[„DPS‟,‟SHJ‟] b)[„dps‟,‟shj‟] c)[„Dps‟,‟Shj‟] d)Error

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.

Q41. What will be the Output for the following code –


Language=["C", "C++", "JAVA", "Python", "VB", "BASIC", "FORTRAN"]
del Language[4]
Language.remove("JAVA")
Language.pop(3)
print(Language)

Page | 7
(a) ['C', 'C++', 'VB', 'FORTRAN'] (b) ['C', 'C++', 'Python', 'FORTRAN']
(c) ['C', 'C++', 'BASIC', 'FORTRAN'] (d) ['C', 'C++', 'Python', 'BASIC']

Q42. Assertion (A) : Keys in a Python dictionary should be unique.


Reason (R) : Only immutable data types can be used as keys.
(a) A is false but R is true.
(b) Both A and R are false.
(c) Both A and R are true but R is not the correct explanation of A.
(d) Both A and R are true and R is the correct explanation of A

Q43. Which of the following is an invalid variable?


a. hello_1 b. hello21 c. Hello_234 d. 3Hello

Q44. Which of the following is not a keyword?


b. if b. nonlocal c. global d. local

Q45. Which of the following is default mode for file opening?


a. „w‟ b. „r‟ c. „a‟ d. „w+‟

Q46. Process of receiving data from a file to program is called


a. Write b. Read c. None of these d. Creation

Q47. Correct method of opening a text file „mytext.txt‟


a. fh1 = open(mytext.txt,‟r‟) b. fh1. open(„mytext.txt‟)
c. fh1. open(„mytext.txt‟,‟ r‟) d. fh1 = open(„mytext.txt‟)

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

In an online lottery system, names having exactly 5 characters are to be displayed.


Piyush has been asked to complete this task. He has created a function FindNames()
in python which read contents from a List of names which contains names of
participants, and displays those names, which are having exactly 5 characters. He
got confused with few statements and left it blank. Help him complete the code.
def FindNames(namelist):
Page | 8
c=0
for name in _____ : #Statement-1
length = _____ #Statement-2
if __________ : #Statement-3
c += 1
print(_____) #Statement-4
print(“Count = “,c)
_________ #Statement-5
_________ # statement 6

50. Write what is missing in statement-1?


(a) list (b) names (c) namelist (d) nameslist

51. Fill in the blank in statement-2 to find the length of name.


(a) namelist.len() (b) name.len() (c) len(namelist ) (d) len(name)

52. Fill in the blank in statement-3 to check its length with 5.


(a) len() = 5 (b) length == 5 (c) len(namelist) = 5 (d) length = len(5)

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

54. Fill in the blank in Statement-5 to return from function.


(a) return (b) return() (c) return namelist (d) return 1

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy