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-1) for Class 12

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

Published by Full Marks, 2021-11-15 09:00:41

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

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

Search

Read the Text Version

Class 12  SET-1 Series NBSE/XII/2021 TERM-I Code No. 083/12/1 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 (d) _ 2. Which of the following is an invalid variable? (a) my_string_1 (b) 1st_string (c) foo 3. Which of these is not a core data type? (a) Lists (b) Dictionary (c) Tuples (d) Class 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() (d) max() 9. Which function helps us to randomize the items of a list? (a) shuffle() (b) mean() (c) choice() 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) (d) <> 13. Which type of brackets is used to define the tuple? (a) [] (b) () (c) {} 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. What is called when a function is defined inside a class? (a) Module (b) Class (c) Another function (d) Method 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)? (a) Required argument (b) Keyword argument (c) Default argument (d) All of these 23. Parameters are defined inside (d) Parentheses (a) Angular brackets (b) Square brackets (c) Mid brackets 24. Which of the following statements are true? (a) When you open a file for reading, if the file does not exist, an error occurs (b) When you open a file for writing, if the file does not exist, a new file is created (c) When you open a file for writing, if the file exists, the existing file is overwritten with the new file (d) All of the above 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 (d) -5 27. In python ~x=-(x+1) then, what does ~~~~~5 evaluate to? (a) -6 (b) -11 (c) +11 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 NBSE 2021 3 [P.T.O.

29. What will be the output of the following code? x= \"abcdef\" i= \"i\" while i in x: print (i, end= \" \") (a) a b c d e f (b) abcdef (c) i i i i i … (d) No output 30. Which is the correct form of declaration of dictionary? (a) Day={1:'monday',2:'tuesday'.3:'wednesday'} (b) Day=(1;'monday',2;'tuesday'.3;'wednesday') (c) Day=[1:'monday',2:'tuesday'.3:'wednesday'] (d) Day={1'monday',2'tuesday'.3'wednesday'} 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\") (a) a new line and hello (b) \\nhello (c) The letter r and then hello (d) Error 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'] (b) a b c d (c) ['a','b','c','d'] (d) None print\" \".join(L) (a) Error 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 NBSE 2021 5 [P.T.O.

a=15 (b) 35 (c) 15 (d) 10 b=20 print(a) call() (a) 25 42. 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) (a) ['C', 'C++', 'VB', 'FORTRAN'] (b) ['C', 'C++', 'Python', 'FORTRAN'] (c) ['C', 'C++', 'BASIC', 'FORTRAN'] (d) ['C', 'C++', 'Python', 'BASIC'] 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 1 two II three III three III 45. What is the output of the program given below? num = 45 def func (num): num = 23 func (num) print ('num is now', num) (a) num is now 45 (b) num is now 23 (c) num is now 68 (d) Error 46. What will be the output of the following? >>> list1=[1,2,3] NBSE 2021 6

>>> list2=[1,2,2,3] >>> list1>list2 (a) Error (b) False (c) True (d) None (d) 2 4 9 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 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) (d) Error 49. If the content of the file \"wish.txt\" is — \"Happy\", then what will be the content of the file after executing the following statements? f=open(\"wish.txt\", 'w') f.write(\"Birthday\") f.close() (a) Happy Birthday (b) HappyBirthday (c) Happy (d) Birthday SECTION-C (CASE STUDY) This section consists of 6 Questions (50 -55). Attempt any 5 questions. Radha Shah is a programmer, who has recently been given a task to write a python code to perform the following CSV file operations with the help of two user defined functions/modules: (a) CSVOpen( ) : to create a CSV file called BOOKS.CSV in append mode containing information of books — Title, Author and Price. (b) CSVRead( ) : to display the records from the CSV file called BOOKS.CSV where the field title starts with 'R' . She has succeeded in writing partial code and has missed out certain statements, so she has left certain queries in comment lines. import csv def CSV Open( ) : with open ('books.csv','…….',newline=' ') as csv f: #Statement-1 cw=……… #Statement-2 ………….. #statement-3 NBSE 2021 7 [P.T.O.

Cw.writerow(['Rapunzel','Jack',300]) Cw.writerow(['Barbie','Doll',900]) Cw.writerow(['Johnny','Jane',280]) Def CSV Read(): try: #Statement-4 with open ('books.csv','r') as csv f: #Statement-5 cr=……… for r in cr: if………… : print(r) except: print('File Not Found') CSV Open() CSV Read() You as an expert of Python have to provide the missing statements and other related queries based on the following code of Radha. 50. Choose the appropriate mode in which the file is to be opened in append mode (Statement 1). (a) w+ (b) ab (c) r+ (d) a 51. Which statement will be used to create a csv writer object in Statement 2. (a) csv.writer(csvf) (b) csvf.writer(csvf) (c) csvf.writer() (d) cs.writer(csvf) 52. Choose the correct option for Statement 3 to write the names of the column headings in the CSV file, BOOKS.CSV. (a) cw.writerow('Title', 'Author', 'Price') (b) cw.writerow(['Title', 'Author, 'Price']) (c) cw.writerows('Title', 'Author', 'Price') (d) cw.writerows(['Title', 'Author', 'Price]) 53. Which statement will be used to read a csv file in Statement 4. (a) cs.read(csvf) (b) csv.reader(csvf) (c) csvf.read() (d) csvf.reader(cs) 54. Fill in the appropriate statement to check the field Title starting with 'R' for statement 5 in the above program. (a) r[0][0]=='R' (b) r[1][0]=='R' (c) r[0][1]=='R' (d) r[1][1]=='R' 55. CSV stands for (a) Comma Separated Values (b) Comma Single Version (c) Common Seprated 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