FIRST PREBOARD EXAMINATION
CLASS: XII SESSION: 2024-25
COMPUTER SCIENCE (083)
Time allowed: 3 Hours SET-1 Maximum Marks: 70
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.
| Q No | Section-A (21 x 1 = 21 Marks) | Marks |
| 1 | State true or false: – The following lists represent the same list. L1= [‘a’, ‘b’, ‘c’] L2= [‘c’, ‘a’, ‘b’] | 1 |
| 2 | What will be the output of the following code? a) 5#50# b) 50#50 c) 5#5 d) 50#30 | 1 |
| 3 | Which operator performs pattern matching? a) LIKE operator b) BETWEEN operator c) None of these d) EXISTS operator | 1 |
| 4 | To read the next line of the file from a file object infi, we use a) infi.read() b) infi.readlines() c) infi.readline() d) infi.read(all) | 1 |
| 5 | Convert the following mathematical expression to Python expression: A2B3+√b | 1 |
| 6 | What will be output of the following code:- a=[2] a+=[123] a+=[“123”] a+=”123″ print(a) | 1 |
| 7 | What will be the output of the following Python code?
(a) 25*50%100%25 (b) 50* 100%100%100 (c) 25*50%100%100 (d) Error | 1 |
| 8 | Select the correct output of the code: Options: [a] Best-ALL-The [b] BEST-ALL-THE [c] Best-All-THE [d] BEST-ALL-The | 1 |
| 9 | The SELECT statement when combined with __________ clause, returns records without repetition. (a) DESCRIBE (b) UNIQUE (c) DISTINCT (d) NULL | 1 |
| 10 | Name the python library for the following functions: [a]sin() [b]dump() | 1 |
| 11 | Predict the output of the following code: x = (1, 2, 3) y = (3, 4) t = x + y print(t,end=”) list(t)[2] = 4 print(t) [a] (1, 2, 3, 3, 4)(1, 2, 3, 3, 4) [b] (1, 2, 3, 3, 4)[1, 2, 3, 3, 4] [c] (1, 2, 3, 3, 4) (1, 2, 3, 3, 4) [d] Error Message | 1 |
| 12 | Arguments which are initialized during calling time, and its name is same as parameter is called _________ a)Default b)Positional c)Keyword d) None of these | 1 |
| 13 | Name SQL built in function that compute the total number of unique values of a column. | 1 |
| 14 | In SQL, what is the use of IS NULL operator? | 1 |
| 15 | Which two select queries will give the same output A. SELECT NAME, GRADE FROM STUDENTS,SPORTS WHERE ADDRESS IS NULL AND STUDENTS.ADMNO =SPORTS.ADMNO ; B. SELECT NAME, GRADE FROM STUDENTS,SPORTS WHERE ADDRESS IS NOT NULL AND STUDENTS.ADMNO =SPORTS.ADMNO ; C SELECT NAME, GRADE FROM STUDENTS,SPORTS WHERE ADDRESS IS NULL OR STUDENTS.ADMNO=SPORTS.ADMNO ; D. SELECT ST.NAME, SP.GRADE FROM STUDENTS ST,SPORTS SP WHERE ADDRESS IS NULL AND ST.ADMNO=SP.ADMNO ; a. A AND B b. B AND C c. A AND D d. C AND D | 1 |
| 16 | Consider the following query: Delete from employee; The above command will a. delete last record from the employee table. b. delete first record from the employee table. c. return error. d. delete all records from the employee table. | 1 |
| 17 | Rearrange the following terms in increasing order of data transfer rates: GBPS, MBPS, KBPS, TBPS, BPS | 1 |
| 18 | which transmission media is commonly used in transporting multi-channel television signals in cities ? a)optical fiber b) co-axial cable c) Ethernet cable d) none of these | 1 |
| 19 | The modem at the sender’s computer end acts as a………………. a) model b) modulator c) demodulator d)convertor | 1 |
| Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice as: (A) Both A and R are true and R is the correct explanation for A (B) Both A and R are true & R is not the correct explanation for A (C) A is True but R is False (D) A is False but R is True | ||
| 20 | Assertion (A) The contents of a Binary file are not directly interpretable. Reason (R) Modes in which binary files can be opened are suffixed with ‘b’ like : rb/wb etc. | 1 |
| 21 | Assertion (A) To use the randint() function, the random module needs to be included in the program. Reason (R) Some functions are present in modules and to use them the respective module needs to be imported. | 1 |
| Section-B ( 7 x 2 = 14 Marks) | ||
| 22 | What do mean by sequence datatypes? Give any two examples. | 2 |
| 23 | Evaluate following expressions: [i]7*2%5+16//7/7 [ii]“abc” <”Abcd” and “EFG” or 4<5 | 2 |
| 24 | If a string is defined as x=”ExaM 2025″ [i] (a)print(x[-8::-2], x[(len(x)-3):]*2) OR (b)print(x[1::2],x[-3+1]*2) [ii] (a)print(x.isspace(),x.isalnum()) OR (b)print(x.istitle(),x.capitalize()) | 2 |
| 25 | What possible output(s) are expected to be display execution of the following code? import random HIGH = 20 NUM = 15 for i in range(1,5): N = HIGH+random.randint(11, NUM) print(N, end =’:’) NUM – = 1 Outputs: (a) 35:31:34:32: (b)35:34:33:32: (c)33:34:33:32: (d) 32:31:35:31: | 2 |
| 26 | Rewrite the given code after removing errors in given code, underline the correction. mul=3 | 2 |
| 27 | i) a) Which constraint help us to store only Unique values in a given column. OR b) Which constraint help us to store Unique and NOT NULL values in a given column. ii)a) Write a command to add a new column “Acc NO” with Primary key constraint, in table “Bank”. OR b)Write a command to delete primary key constraint from table “Bank”. | 2 |
| 28 | Why we prefer star topology over other topologies on LAN network? (Write 2 points) OR What are the advantages of bus topology? (Write 2 points) | 2 |
| Section-C ( 3 x 3 = 9 Marks) | ||
| 29 | Write a python function that reads a text file sentence.txt and copy those lines to a new file xyz.txt which starts with 3 letter word, display contents of xyz.txt. OR Write a python function that reads a text file notes.txt and display no of lowercase , uppercase letters separately in each line of file. | 3 |
| 30 | A list, NList contains following record as list elements: [City, Country, distance from Delhi] Each of these records are nested together to form a nested list. Write the following user defined functions in Python to perform the specified operations on the stack named travel. (i)Push_element(NList): It takes the nested list as an argument and pushes a list object containing name of the city and country, which are not in India and distance is less than 3500 km from Delhi. (ii) Pop_element(): It pops the objects from the stack and displays them. Also, the function should display “Stack Empty” when there are no elements in the stack. For example: If the nested list contains the following data: NList=[[“New York”, “U.S.A.”, 11734], [“Naypyidaw”, “Myanmar”, 3219], [“Dubai”, “UAE”, 2194], [“London”, “England”, 6693], 3 [12] [“Gangtok”, “India”, 1580], [“Columbo”, “Sri Lanka”, 3405]] The stack should contain: [‘Naypyidaw’, ‘Myanmar’], [‘Dubai’, ‘UAE’], [‘Columbo’, ‘Sri Lanka’] The output should be: [‘Columbo’, ‘Sri Lanka’] [‘Dubai’, ‘UAE’] [‘Naypyidaw’, ‘Myanmar’] Stack Empty OR Write a function in Python, Push(SItem) where , SItem is a dictionary containing the details of stationary items– {Sname:price}. The function should push the names of those items in the stack who have price greater than 75. Also display the count of elements pushed into the stack. For example: If the dictionary contains the following data: Ditem={“Pen”:106,”Pencil”:59,”Notebook”:80,”Eraser”:25} The stack should contain Notebook Pen The output should be: The count of elements in the stack is 2 | 3 |
| 31 | What will be output of given code for these values of x (a)L[0] b) L[2] c) L[4] L=[10,30,’10’,4.5] try: x=____ y=2 result = x // y except TypeError: print(“see the type”) except IndexError: print(“must have some error”) else: print(“Yeah ! Your answer is :”, result) finally: print(“understood”) OR What will be output of given code for these values of result – a) x/0 b) str(x)*str(y) c) X+y try: x=6 y=1 result = _____ except TypeError: print(“must have correct type”) except ZeroDivisionError: print(“divide by 0 error”) except : print(“must have some error”) | 3 |
| Section-D (4 X 4 = 16 Marks) | ||
| 32 | Table: PRODUCT PCode PName UPrice Rating Brandid P01 Shampoo 120 6 M03 P02 Toothpaste 54 8 M02 P03 Soap 25 NULL M03 P04 Toothpaste 65 4 M04 P05 Soap 38 5 M05 P06 Shampoo 245 6 M05 i-Display average rating of shampoo and soap. ii- Display no of products for each brand. iii- Display the name, price, and rating of products in descending order of rating. iv) Display details of products whose rating is given and price is the range of 500 to 2000 . OR i- select PName,Brandid from PRODUCT where UPrice>60; ii- select Distinct Pname from PRODUCT; iii- select max(UPrice),min(Rating) from PRODUCT where PName Like ’%S’; iv- select avg(Rating) from PRODUCT ; | 4 |
| 33 | A csv file “Happy.csv” contains the data of a survey. Each record of the file contains the following data: ● Name of a country ● Population of the country ● No of participant rejected (NOR) ● No of participant accepted (NOA). Write the following Python functions to perform the specified operations on this file: (I) Read all the data from the file and display all those records for which the population is more than 2000000. II) Count the number of records in the file. | 4 |
| 34 | Saman has been entrusted with the management of Law University Database. He needs to access some information from FACULTY and COURSES tables for a survey analysis. Help him extract the following information by writing the desired SQL queries as mentioned below. Table: FACULTY F_ID FName LName Hire_Date Salary 102 Amit Mishra 12-10-1998 12000 103 Nitin Vyas 24-12-1994 8000 104 Rakshit Soni 18-5-2001 14000 105 Rashmi Malhotra 11-9-2004 11000 106 Sulekha Srivastava 5-6-2006 10000 Table: COURSES C_ID F_ID CName Fees C21 102 Grid Computing 40000 C22 106 System Design 16000 C23 104 Computer Security 8000 C24 106 Human Biology 15000 C25 102 Computer Network 20000 C26 105 Visual Basic 6000 (I) To display details of faculty with last name beginning with s and salary above 15000 (II) To display the details of courses whose fees is in the range of 20000 to 50000 (both values included). (III) To increase the fees of all courses by 500 which have “Computer” in their Course names. (IV) (A) To display names (FName and LName) of faculty taking System Design. OR (B) To display the Cartesian Product of these two tables. | 4 |
| 35 | A table, named Teachers, in School database, has the following structure: Field Type Teachid int(11) TName varchar(15) DOB Date Salary integer Write the following Python function to perform the specified operation: showdetails(): To input details of a teacher and store it in the table Teacher. The function should then retrieve and display all records from the Teacher table where the Salary is greater than 52000. Also display total no. of records in the table Teacher. Assume the following for Python-Database connectivity: Host: localhost, User: root, Password: hello | 4 |
| SECTION E (2 X 5 = 10 Marks) | ||
| 36 | Preeti is a manager working in advertising agency. She needs to manage the records of various candidates. For this she wants the following information of each candidate to be stored: CID – integer CName – string Desig – string Exp – float [I] Write a function to input the data of a candidate and append it in a binary file. [II] Write a function to update the data of candidates whose experience is more than 8 years and change their designation to “Manager”. [III] Write a function to read the data from the binary file and display the data of all those candidates who are not “Manager”. | 5 |
| 37 | “Learn Together “is a company setting up its new campus in Jaipur, which has 4 compounds [ A,B,C and D] Distance between the compounds A to B 110 m A to C 115 m A to D 35 m B to C 25 m B to D 135 m C to D 100 m No. of computers A building 15 B building 40 C building 115 D building 25 [A]Suggest suitable place of switch in the network. [B]Suggest suitable place for repeater between the blocks. [C]Which is most suitable place for server? Give reason also. [D]If institute is going to establish a centre in Nainital, then which transmission medium is suitable for them. Give reason. [E] (I) If institute want to connect all the local units in lucknow, which transmission medium is suitable? OR (II)Mention suitable protocol to send emails on the network. | 5 |
