Class 12 CS 083 Previous Year Question Paper 2022 – Term 1

Series SSJ/2
Question Paper Code 091 Set 4

COMPUTER SCIENCE – TERM 1
(Session 2021-22)

Time allowed : 90 Minutes
Maximum Marks : 35

General Instructions :

  1. The question paper is divided into 3 Sections-A, B, and C.
  2. Section – A consists of 25 Questions (1-25). Attempt any 20 questions.
  3. Section – B consists of 24 Questions (26-49). Attempt any 20 questions.
  4. Section – C consists of 6 case study based Questions (50-55). Attempt any 5 quuestions.
  5. All questions carry equal marks.

SECTION – A

This section consists of 25 Questions (1 to 25). Attempt any 20 questions from this section. Choose the best possible option.

1. Find the invalid identifier from the following
a) name
b) class
c) section
d) break

2. Which of the following is a function/method of the pickle module?
a) reader()
b) writer ()
c) load ()
d) read ()

3. For a given declaration in Python as s="WELCOME"
Which of the following will be the correct output of print (S [1::2]) ?
a) WEL
b) COME
c) WLOE
d) ECM

4. Which of the following statement is not correct?
a) We can write content into a text file opened using ‘w’ mode
b) We can write content into a text file opened using ‘w+’ mode
c) We can write content into a text file opened using ‘r’ mode
d) We can write content into a text file opened using ‘r+’ mode

5. Which of the following option is the correct Python statement to read and display the first 10 characters of a text file “Notes. txt” ?
a) F = open( '"Notes.txt'); print (F.load (10))
b) F = open ( 'Notes.txt'); print (F.dump (10))
c) F = open ('Notes.txt'); print (F.read (10))
d) F = open ( 'Notes.txt'); print (F.write (10))

6. Which of the following is not a correct Python statement to open a text file “Notes. txt” to write content into it ?
a) F = open ('Notes.txt', 'w')
b) F = open ('Notes.txt', 'a')
c) F = open ('Notes.txt', 'A')
d) F = open ('Notes.txt', 'w+')

7. A text file opened using the following statement
MyFile=open (‘Notes.txt’)
Which of the following is the correct Python statement to close it?

a) MyFile=close ('Notes.txt')
b) MyFile.close ('Notes.txt')
c) close.MyFile ()
d) MyFile.close ()

8. Which of the following option is the correct usage for the tell() of a file object?
a) It places the file pointer at a desired offset in a file
b) It returns the entire content of a file
c) It returns the byte position of the file pointer as an integer
d) It tells the details about the file

9. Which of the following is an incorrect Logical operator in Python ?
a) not
b) in
c) or
d) and

10. Given the Python declaration s1="Hello" . Which of the following statements will give an error?
a) print (S1[4])
b) S2=S1
c) S1=S1[4]
d) s1[4]="Y"

11. Which of the following statement is incorrect in the context of pickled binary files?
a) csv module is used for reading and writing objects in binary files.
b) pickle module is used for reading and writing objects in binary files.
c) load () of the pickle module is used to read objects
d) dump () of the pickle module is used to write objects

12. What is the significance of the seek() method?
a) It seeks the absolute path of the file.
b) It tells the current byte position of the file pointer within the file.
c) It places the file pointer ata desired offset within the file.
d) It seeks the entire content of the file.

13. Which of the following is the correct expansion of csv ?
a) Comma Separated Values.
b) Centrally Secured Values.
c) Computerised Secured Values.
d) Comma Secured Values.

14. If the following statement is used to read the contents of a textfile object F:
X-F.readlines ()

Which of the following is the correct data type of x?
a) string
b) list
c) tuple
d) dictionary

15. Which of the following is not correct in context of Positional and Default parameters in Python functions?
a) Default parameters must occur to the right of Positional parameters
b) Positional parameters must occur to the right of Default parameters
c) Positional parameters must occur to the left of Default parameters
d) All parameters to the right of a Default parameter must also have Default values.

16. For a function header as follows:
def Calc (X, Y=20)
Which of the following function calls will give an Error?
a) Calc (15,25)
b) Calc (X=15,Y=25)
c) Calc (Y=25)
d) Calc (X=25)

17 Which of the following is not correct in context of scope of variables ?
a) global keyword is used to change value of a global variable in a local scope
b) local keyword is used to change value of a local variable in a global scope
c) global variables can be accessed without using the global keyword in a local scope
d) local variables cannot be used outside its scope

18. Which of the following is the default character for the newline parameter for a csv file object opened in write mode in Python IDLE ?
a) \n
b) \t
c) '
d) ;

19. Which of the following is the correct output for the execution of the following Python statement?
print(5+3**2/2)
a) 32
b) 8.0
c) 9.5
d) 32.0

20. Which of the following is not a Tuple in Python?
a) (1,2,3)
b) ("One","Two","Three")
c) (10 ,)
d) ("one")

21. Which of the following is not a function/method of the random module in Python
a) randfloat ()
b) randint ()
c) random ()
d) randrange ()

22. Which of the following is not a valid Python string operation ?
a) 'Welcome'+'10'
b) 'Welcome' *10
c) 'Welcome' * 10.0
d) "10" + 'Welcome'

23. What will be the output for the following Python statements?
T=(10,20,[30,40,50],60,70)
T[2][1]=100
print (T)

a) (10, 20, 100, 60, 70)
b) (10, 20, [30,100,50], 60, 70)
c) (10, 20, [100,40,50], 60, 70)
d) Error

24. What will be the output for the following Python statements?
L = [10, 20, 30, 40, 50]
L = L+5
print (L)

a) [10, 20, 30, 40, 50, 5]
b) [15, 25, 35, 45, 55]
c) [5, 10, 20, 30, 40, 50]
d) Error

25. What will be the output for the following Python statements ?
D= {"AMIT":90, "RESHMA":96, "SUKHBIR":92, "JOHN":95}
print ("JOHN" in D, 90 in D, sep = "#")

a) Truef#False
b) True#True
c) False#True
d) False#False

SECTION – B

This section consists of 24 Questions (26 to 49). Attempt any 20 questions.

26. Nitish has declared a tuple T in Python as following:
T = (10, 20, 30)
Now, he wants to insert an element 40 after these three elements of T so that the tuple may contain (10, 20, 30, 40).
Which of the following statements shall Nitish write to accomplish the above task?

a) T = T + 40
b) T = T+ (40)
c) T = T + (40,)
d) Nitish cannot insert 40 into the tuple since Tuples are immutable

27. Suppose the content of a text file Notes.txt is:
“The way to get started is to quit talking and begin doing”
What will be the output of the following Python code ?
F = open ("Notes.txt")
F.seek (29)
S=F.read ()
print (S)

a) The way to get started is to
b) quit talking and begin doing
c) The way to get started is to quit talking and begin doing
d) gniod nigeb dna gniklat tiuq ot si detrats teg ot yaw ehT

28. Identify the output of the following Python statements
S = "GOOD MORNING"
print (S.capitalize (),S.title () ,end=" ! ")

a) GOOD MORNING!Good morning
b) Good Morning!Good morning
c) Good morning! Good Morning!
d) God morning Good Morning!

29. Identify the output of the following Python statements
L = []
for i in range (4):
L.append (2*i+1)
print (L[::-1])

a) [7,5,3,1]
b) [9,7,5,3]
c) [4,3,2,1]
d) [1,2,3,4]

30. Identify the output of the following Python statements:
D={}
T= ("ZEESHAN", "NISHANT", "GURMEET", "LISA")
for i in range (1, 5):
D[i]=T[i-1]
print (D)

a) {"ZEESHAN", "NISHANT", "GURMEET","LISA"}
b) "ZEESHAN", "NISHANT", " GURMEET","LISA"
c) {[1, "ZEESHAN"],[2, "NISHANT"], [3, "GURMEET"], [4," LISA" ]}
d) {1:"ZEESHAN" ,2:"NISHANT" ,3:"GURMEET" , 4:"LISA"}

31. Identify the output of the following Python statements
L1, L2= [10, 15, 20, 25], []
for i in range (len (L1)) :
L2. insert( i,L1.pop ())
print (LI, L2, sep="&")

a) [] & [25, 20, 15, 10]
b) [10, 15, 20, 25] & [25, 20, 15, 10]
c) [10, 15, 20, 25] & [10, 15, 20, 25]
d) [25, 20, 15, 10] & []

32. Which of the following Python modules is imported to store and retrieve objects using the process of serialization and deserialization?
a) csv
b) binary
c) math
d) pickle

33. Which of the following function is used with the csv module in Python to read the contents of a csv file into an object ?
a) readrow()
b) readrows()
c) reader()
d) load()

34. What will be the output of the following Python code?
S="WELCOME"
def Change (T) :
T="HELLO"
print (T, end='@')
Change (S)
print (S)

a) WELCOME@HELLO
b) HELLO@HELLO
c) HELLO@WELCOME
d) WELCOME@WELCOME

35. Identify the correct possible output for the following Python code :
import random
for N in range (2,5,2) :
Print (random.randrange (1,N) ,end="#")

a) 1#3#5#
b) 2#3#
c) 1#4#
d) 1#3#

36. What will be the output of the following Python code ?
def FunStr (S)
T=""
for i in S :
if i.isdigit () :
T=T+i
return T
X = "PYTHON 3.9"
Y = FunStr (X)
print (X, Y, sep="*")

a) PYTHON 3.9
b) PYTHON 3.9*3.9
c) PYTHON 3.9*39
d) Error

37. What will be the output of the following Python code?
v = 50
def Change (N) :
global V
V, N = N, V
print (V, N, sep="#",end="@")
Change (20)
print (V)

a) 20#50@20
b) 50@20#50
c) 50#50#50
d) 20@50#20

38. Which of the following option can be the output for the following Python code?
L1=[10,20,30,20,10]
L2=[]
for i in L1:
if i not in L2:
L2.append(i)
print (L1, L2,sep="&")

a) [10,20,30,20,10]&[10,20,30,20,10]
b) [10,20,30,20,10]&[10,20,30,20,10]&
c) [10,20,30,20,10]&[30,20,10]
d) [10,20,30,20,10]&[10,20,30]

39. What is the output of the following Python code ?
def ListChange () :
for i in range (len (L)):
if L[i]%2 == 0 :
L[i]=L[i]*2
if L[i]%3 == 0 :
L[i]=L[i]*3
else
L[i]=L[i]*5
L = [2,6,9,10]
ListChange ()
for i in L:
print (i,end="#")

a) 4#12#27#20#
b) 6#18#27#50#
c) 20#36#27#100#
d) Error

40. Suppose the content of a text file “Rhymes.txt” is as follows
Jack & Jill
went up the hill

What will be the output of the following Python code ?
F = open ("Rhymes.txt")
L = F.readlines ()
for i in L:
S=i.split()
print (len (S) ,end="#")

a) 2#4#
b) 3#4#
c) 2#
d) 7#

41. Identify the output of the following Python code:
D={1:"One", 2:"Two", 3: "Three"}
L=[]
for K,V in D. items ():
if V[0]=="T":
L.append (K)
print (L)

a) [1,2,3]
b) ["One", "Two", "Three"]
c) [2,3]
d) ["Two", "Three"]

42. Suppose the content of “Rhymes.txt” is:
Baa baa black sheep
have you any wool?

What will be the output of the following Python code?
F = open ("Rhymes.txt")
S = F.read ()
L=S.split ()
for i in L:
if len (i) %3 != 0 :
print (i, end= " ")

a) Baa baa you any
b) black have wool?
c) black sheep, have wool?
d) Error

43. Suppose the content of “Rhymes.txt” is
One, two, three, four, five
Once. I caught a fish alive.

What will be the output of the following Python code ?
F = open ("Rhymes.txt")
S = F.read ()
print (S.count('e',20))

a) 20
b) 1
c) 3
d) 6

44. What will be the output of the following Python code?
V = 25
def Fun (Ch) :
V=50
print (V, end=Ch)
V *= 2
print (V, end=Ch)
print (V, end="*")
Fun ("!")
print (V)

a) 25*50!100!25
b) 50*100!100!100
c) 25*50!100!100
d) Error

45. Suppose the content of “Rhymes.txt” is
Good Morning Madam
What will be the output of the following Python code?
F = open ("Rhymes.txt")
L = F.read ().split ()
for W in L:
if W.lower () == W[::-1].lower ():
print (W)

a) Good
b) Morning
c) Madam
d) Error

46. Suppose the content of “Rhymes.txt” is
Hickory Dickory Dock
The mouse went up the clock

What will be the output of the following Python code?
F = open ("Rhymes. txt")
L = F. readlines ()
X = ["the", "ock"]
for i in L:
for W in i.split () :
if W in X:
print (W, end = "*")

a) the*
b) Dock*The*the*clock*
c) Dock*the*clock*
d) Error

47. Consider the following directory structure.
Class-12-CS-083-Previous-Year-Question-Paper-2022-term-1-Q47
Suppose the present working directory is MyCompany. What will be the relative path of the file Transactions.Dat?
a) MyCompany/Transactions.Dat
b) MyCompany/Accounts/Transactions.Dat
c) Accounts/Transactions.Dat
d) ../Transactions.Dat

48. What will be the output of the following Python code?
S="UVW" ;L=[10,20,30] ;D={}
N=len (S)
for I in range (N) :
D[L[I] = s[]
for K,V in D.items () :
print (K,V, sep="*" ,end=",")

a) U*10,V*20,W*30,
b) 10*U, 20*V,30*W,
c) 10,20,30,U*V*W*
d) Error

49. What will be the output of the following Python code ?
L = [10, 20]
L1=[30, 40]
L2=[50, 60]
L.append (L1)
L.extend (L2)
print (L)

a) [60, 50, 40, 30, 20, 10]
b) [10, 20, 30, 40, 50, 60]
c) [10, 20, 30, 40, [50, 60]]
d) [10, 20, [30, 40], 50, 60]

SECTION – C – Case Study based Questions

This section consists of 6 Questions (50 – 55). Attempt any 5 questions.

Nisha, an intern in ABC Pvt. Ltd., is developing a project using the csv module in Python. She has partially developed the code as follows leaving out statements about which she is not very confident. The code also contains errors in certain statements. Help her in completing the code to read the desired CSV File named “Employee.csv”
Class-12-CS-083-Previous-Year-Question-Paper-2022-term-1-case-study

50. Nisha gets an Error for the module name used in Statement-1. What should she write in place of CSV to import the correct module ?
a) file
b) csv
c) Csv
d) pickle

51. Identify the missing code for blank spaces in the line marked as Statement-2 to open the mentioned file.
a) "Employee.csv", "r"
b) "Employee.csv", "w"
c) "Employee.csv", "rb"
d) "Employee.csv", "wb"

52. Choose the function name (with parameter) that should be used in the line marked as Statement-3.
a) reader (File)
b) readrows (File)
c) writer (File)
d) writerows (File)

53. Nisha gets an Error in Statement-4. What should she write to correct the statement?
a) for R in ER:
b) while R in range (ER) :
c) for R = ER:
d) while R = ER:

54. Identify the suitable code for blank space in Statement-5 to match every row’s 3rd property with “ACCOUNTS”.
a) ER[3]
b) R[2]
c) ER[2]
d) R[3]

55. Identify the suitable code for blank space in Statement-6 to display every Employee’s Name and corresponding Department?
a) ER[1], R[2]
b) R[1], ER[2]
c) R[1], R[2]
d) ER[1], ER[2]

Find Class 12 Computer Science Previous Year Question Papers

Find Class 12 Computer Science Previous Year Question Papers Solution

Find Class 12 Computer Science Previous Year Compartment Question Papers

Find Class 12 Computer Science Previous Year Compartment Question Papers Solution

Leave a Comment