Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore NBSE Question Papers Computer Science Term-1 (Set-3) for Class 12

NBSE Question Papers Computer Science Term-1 (Set-3) for Class 12

Published by Full Marks Pvt Ltd, 2021-11-16 09:24:54

Description: NBSE Question Papers Computer Science Term-1 (Set-3) for Class 12

Keywords: NBSE Question Papers Computer Science Term-1 (Set-3) for Class 12

Search

Read the Text Version

Class 12  SET-3 Series NBSE/XII/2021 TERM-I Code No. 083/12/3 Roll No.  Candidates must write the Code No. on the title page of the OMR sheet. l Please check that this question paper contains 8 pages. l Code number given on the right hand side of the question paper should be written on the title page of the OMR sheet. l Please check that this question paper contains 55 questions. l 15 minutes time has been allotted to read this question paper. COMPUTER SCIENCE 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 questions. 5. All questions carry equal marks. NBSE 2021 1 [P.T.O.

SECTION A This section consists of 25 Questions (1 to 25). Attempt any 20 questions from this section. Choose the best possible option. 1. Which of the following is valid arithmetic operator in Python? (a) // (b) ? (c) < (d) and 2. Which of the following is an invalid variable? (a) my_string_1 (b) 1st_string (c) foo (d) _ 3. What will be the output of the following code. Str=\"This is Meera\\' pen\" print(Str.isdigit()) (a) 21 (b) 20 (c) 18 (d) 19 4. Which statement will check if a is equal to b? (a) if a = b: (b) if a = = b: (c) if a = = = c: (d) if a = = b 5. Which type of error occurs when rules of programming language are misused? (a) Syntax error (b) Semantic error (c) Run time error (d) Logical error 6. Text files store information in ……. Characters. (a) ASCII (b) Unicode (c) Both (a) and (b) (d) None of these 7. Sorting means arranging the elements in (a) Ascending order (b) Descending order (c) Either (a) or (b) (d) None of these 8. To read two bytes from a file object infile, we use (a) infile.read(2) (b) infile.read() (c) infile.readline() (d) infile.readlines() 9. ………..function will always return tuple of 3 elements. (a) index() (b) split() (c) partition() (d) strip() 10. When one or more elements of a list is another list, it is called (a) nested list (b) super list (c) hit list (d) sub list (d) delete() 11. Which method is used to delete a given element from the list? (a) rem() (b) remove() (c) del() 12. Which method is used to return count of tuple elements? (a) len(t) (b) count(t) (c) Total(T) (d) Sum(T) 13. Which type of brackets is used to define the tuple? (a) [] (b) () (c) {} (d) <> 14. The unordered and changeable collection of data values that holds key value pairs is (a) List (b) Tuple (c) Dictionary (d) String 15. Identify the elements that are classified by Python dictionary. (a) Keys (b) Values (c) Both (a) and (b) (d) None of these 16. ………….. is a file containing Python definitions and statements. (a) Module (b) List (c) Tuple (d) Dictionary NBSE 2021 2

17. Which keyword is used to import the module ……? (a) Import module (b) Module (c) Import (d) None of these 18. How are required arguments specified in the function heading? (a) identifier followed by an equal to sign and the default value (b) identifier followed by the default value within backticks (\") (c) identifier followed by the default value within squarebrackets ([ ]) (d) identifier 19. What will be the output of the following code? print(type(type(int))) (a) type 'int' (b) <class 'type'> (c) Error (d) <class 'int'> 20. Which of the following is the use of id() function in python? (a) id() returns the identity of the object (b) Every object doesn't have a unique ID (c) All of the mentioned (d) None of the mentioned 21. Which of the following refers to mathematical function? (a) sqrt (b) Rhombus (c) add (d) Sqrt add 22. Which of these is/are formal argument(s)? (b) Keyword argument (a) Required argument (d) All of these (c) Default argument 23. Parameters are defined inside (d) Parentheses (a) Angular brackets (b) Square brackets (c) Mid brackets 24. What is the output of the function shown below (random module has already been imported)? print(random.choice('sun')) (a) sun (b) u (c) Either s, u or n (d) Error 25. It determines the mode in which the file has to be opened. It is (a) file name (b) access_mode (c) dump (d) pickle SECTION B This section consists of 24 Questions (26 to 49). Attempt any 20 questions. 26. What will be output of this expression 'p' + 'q' (a) pq (b) rs (c) pqrs (d) pq12 27. Rahul want to know that how many elements are there in the tuple t, which statement he should use out of the given four (a) >>>t.count() (b) >>>len(t) (c) >>>count(t) (d) >>>t.sum() NBSE 2021 3 [P.T.O.

28. What will be the output of the following code? x = 12 for i in x: print(i) (a) 12 (b) 1 2 (c) Error (d) None of these 29. What will be the output of the following code? x= \"abcdef\" i= \"i\" (b) abcdef (c) i i i i i … (d) No output while i in x: print (i, end= \" \") (a) a b c d e f 30. Rahul wants to delete all the elements from the tuple, which statement he should use (a) >>>del t (b) >>>t.clear() (c) >>>t.remove() (d) >>>None of these 31. Suppose a tuple T is declared as T=(10,12,43,39), which of the following is incorrect? (a) print(T[1]) (b) T[2]= -29 (c) print(max(T)) (d) print(len(T)) 32. What is the output when the following code is executed? print(r\"\\nhello\") (b) \\nhello (a) a new line and hello (d) Error (c) The letter r and then hello 33. Consider the following code and answer the question that follows: Book={1:'Thriller',2:'Mystery',3:'Crime',4:'Children Stories'} Library={'5':'Madras Diaries', '6':'Malgudi Days'} Ramesh needs to change the title in the dictionary book from 'Crime' to 'Crime thriller'. He has written the following command: Book['Crime']='Crime Thriller' But he is not getting the answer. Help him choose the correct command: (a) Book[2]='Crime Thriller' (b) Book[3]='Crime Thriller' (c) Book[2]=('Crime Thriller') (d) Book[3]=('Crime Thriller') 34. What will be the output of the following code? L=['a','b','c','d'] print\" \".join(L) (a) Error (b) a b c d (c) ['a','b','c','d'] (d) None 35. What will be the output of the following python code? def cube(x): return x*x*x x=cube(2) print(x) (a) 2 (b) 4 (c) 8 (d) 20 NBSE 2021 4

36. Here is the function to find the sum of arguments total = 0 #Line1 def sum(arg1, arg2): #Line2 total = arg1 + arg2 #Line3 print (\"total:\", total) #Line4 return total #Line5 sum (10, 20) #Line6 print (\"…… : \", total) #Line7 Fill the blank in line 7 (a) Sum (b) True (c) False (d) Total 37. To open a file c:\\scores.txt for reading, we use …….. (a) infile=open(\"c:\\scores.txt\",\"r\") (b) infile=open(\"c:\\\\scores.txt\",\"r\") (c) infile=open(file=\"c:\\scores.txt\",\"r\") (d) infile=open(file=\"c:\\\\scores.txt\",\"r\") 38. What will be the output of the following Python code? f=None for i in range (5): with open(\"data.txt\",\"w\") as f: if i > 2: break print(f.closed) (a) true (b) false (c) None (d) Error 39. What will the following code produce? T=['kvs','rpr'] T1=range (len(T)) for i in T1: T[i]=T[i].upper() print(T) (a) ['KVS','RPR'] (b) ['kvs','rpr'] (c) ['Kvs','Rpr'] (d) Error 40. Consider square numbers defined as follows: compute(1) = 1 compute(N) = computer(N-1) + 2N-1 According to this definition, what is compute (3)? (a) compute(3) = compute(2) +compute(1) (b) compute(3) = compute(2) + 2*3-1 (c) compute(3) = compute(2) -2'3+1 (d) compute(3) = compute(3) +2*3-1 41. What will be the output of the following python code? a=10 def call(): global a a=15 NBSE 2021 5 [P.T.O.

b=20 (b) 35 (c) 15 (d) 10 print(a) call() (a) 25 42. What will be the output for the following code? def func(*args): for i in args: print (i) func(1,2,3) (a) 1 (b) 1 2 3 (c) Error (d) None 2 3 43. Choose the correct option with reference to below Python code? def fn(a): print(a) x=90 fn(x) (a) x is the formal argument. (b) a is the actual argument. (c) fn(x) is the function signature. (d) x is the actual argument. 44. What is the output of the following? d = (\"one\": 'I', \"two\" : 'II', \"three\" :'III'} for i in d: print(i) (a) one (b) I (c) one I (d) 0 two II two II 1 three III three III 45. Which is NOT the possible output of the program given below? import random periph = ['Mouse', 'Keyboard', 'Printer', 'Monitor'] for i in range (random.randint(0,2)): print (periph[i], '*', end=\" \") (a) Mouse*Keyboard* (b) Mouse* (c) Mouse*Keyboard*Printer* (d) no output 46. Find the output of the following >>> list1=[1,2,3] >>> list2=[1,2,2,3] >>> list1>list2 (a) Error (b) False (c) True (d) None NBSE 2021 6

47. Consider the following code: import math import random print(str(int(math.pow(random.randint(2,4),2))),end= ' ') print(str(int(math.pow(random.randint(3,4),2),end= ' ') print(str(int(math.pow(random.randint(4,4),2)))) What could be the possible outputs of the given four choices? (a) 2 3 4 (b) 9 16 16 (c) 16 4 16 (d) 2 4 9 (d) Error 48. Consider the tuple in python named NUM=(1,2,3). What will be the value of DOUBLE, if - >>> DOUBLE=NUM*2 (a) (2,4,6) (b) (1,1,2,2,3,3) (c) (1,2,3,1,2,3) 49. Write the output of the following code f = open(\"data.txt\", \"r\") d =read() d1 = read(5) print(d) print(d1) #data file contains the following data Welcome to python program (a) Welcome to python program (b) Welco (c) error (d) None SECTION-C (CASE STUDY) This section consists of 6 Questions (50 -55). Attempt any 5 questions. Ananya, a class 12 student is asked to write a binary file, \"Fees.DAT\", for entering fee details of students and review the details when required. She faced some problems in statements and see if you can fill the missing code. import pickle def fee Entry(): Feelst=[] fobj=open(\"Fees.dat\",\"___\") #Line1 to open file for entering data to file while True: AdmnNo=int(input(\"Admission Number : \")) Stud_name=input(\"Name :\") Class = input(\"Enter Class: \") NBSE 2021 7 [P.T.O.

Fee = int(input(\"Enter Fee : \")) rec=[AdmnNo,Stud_Name,Class,Fee] Feelst.append(______) #Line2 to add a record choice=input(\"Enter more y/n\") if choice in \"Nn\": break _________________ #Line3 to store data to file fobj.close() def get Records(AdmNo): fobj=_______________ #Line4 to open file for searching result=pickle.load(fobj) for rec in result: if rec[0]==______: #Line5 to check for given admission number print(rec) fobj.close() 50. Identify missing code in Line1 so that file can add more information (a) w (b) r (c) wb (d) rb 51. Identify missing object in Line2 (a) fobj (b) R (c) rec (d) admission 52. Fill in the necessary function in Line3, to input data to binary file. (a) pickle.dump(\"Feelst\",\"fobj\") (b) pickle.dump(Feelst,fobj) (c) pickle.dump(\"fobj\",\"Feelst\") (d) pickle.dump(fobj,Feelst) 53. Fill in the blank in Line4, to read data from file. (a) open(\"Fees.dat\",\"read\") (b) open(\"Fees.dat\",\"r\") (c) open(\"Fees.dat\",\"rd\") (d) open(\"Fees.dat\",\"rb\") 54. Fill in the blank in Line5 to check for given admission number: (a) AdmnNo (b) \"AdmnNo\" (c) AdmNo (d) \"AdmNo\" 55. CSV stands for (a) Comma Separated Values (b) Comma Single Version (c) Common Separated Values (d) Common Single Version NBSE 2021 8


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook