[go: up one dir, main page]

0% found this document useful (0 votes)
72 views15 pages

Computer Science

The document outlines a question paper consisting of 37 questions divided into 5 sections, covering various topics in Python programming and SQL. Each section has a different mark allocation, and the paper includes multiple-choice questions, programming tasks, and theoretical questions. Specific instructions are provided for answering questions, including the use of Python language for programming tasks.

Uploaded by

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

Computer Science

The document outlines a question paper consisting of 37 questions divided into 5 sections, covering various topics in Python programming and SQL. Each section has a different mark allocation, and the paper includes multiple-choice questions, programming tasks, and theoretical questions. Specific instructions are provided for answering questions, including the use of Python language for programming tasks.

Uploaded by

cajdhhs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 15
a General Instructions : @ This question paper contains 37 questions. (ii) All I are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions. (tii) The paper is divided into 5 Sections — A, B, C, Dand E. (iv) Section A, consists of 21 questions (1 to 21). Each question carries I mark. (%) Section B, consists of 7 questions (22 to 28). Each question carries 2 marks. (vi) Section C, consists of 3 questions (29 to 31). Each question carries 3 marks. (vii) Section D, consists of 4 questions (82 to 35). Each question carries 4 marks. (viii) Section E, consists of 2 questions (36 & 37). Each question carries 5 marks. (ix) All programming questions are to be answered using Python Language only. (x) Incase of MCQ5s, text of the correct answer should also be written. SECTION -A (21x 1=21) State True or False : “A Python List must always contain all its elements of same data type.” What will be the output of the following statement ? 1 print (14%3**2*4) (A) 16 (B) 64 (C) 20 (@D) 256 Page 3 of 32 ~ P.T.O. 91 Se El 4, Identify the correct output of the following code snippet game=" Olympic2024" print (game.index("C")) @) 0 ®) 6 © 1 () valueError 4, Which of the following is the correct identifier ? (A) global (B) Break (C) det @) with 5, Identify the invalid Python statement out of the following options : "4 10) (A) print ("A",10,end="*") (B) print("A", ) () print ("A"*10) (C) print ("A" 10, sep=' Consider the statements given below and then choose the correct output from the given options : Is['TIC', 'TAC'] print (L[::-1]) (A) {'err', ‘caT’] (@) ['TIc', 'TAC'] (C) [('car', 'crT"] (D) ['Tac', 'TIC'] 4. Which of the following operator evaluates to True if the variable on either side of the operator points towards the same memory location and False otherwise ? 5 (a de (B) is not (C) and D) oF Page 5 of 32 ~ PTO. 91 ——_—— s)# 10. 11. Consider the statements given below and then choose the correct output from the given options : D={'S01':95, 'S02':96 } 1 for I inD: print (I,end='#') (A) so1#so2# (B) 95#96# (©) 801,95#S02,96# (D) so1#95#s02#96# While creating a table, which constraint does not allow insertion of duplicate values in the table ? 1 (A) UNIQUE (B) DISTINCT (C) NOT NULL (D) HAVING Consider the statements given below and then choose the correct output from the given options : def Change (N) : N=N+10 print (N,end='$$') N=15 Change (N) print (N) (A) 25$$15 (C) 25$$25 (B) 15$$25 (D) 2525$$ Consider the statements given below and then choose the correct output from the given options : N='5' try: print ( except: print ( 'ERROR' ,end='#') finally: print ('OVER') (A) ERROR# (C) WORDS# x 'WORD' + N, end='#') (B) WORDS#OVER (D) ERRORFOVER Page 7 of 82 14. 16. 17, Which of the following built-in function/method returns a dictionary ? (A) dict() (®) keys() © > values() (@) items () Which of the following is a DML command in SQL? (A) UppaTE (B) CREATE (© ALTER (D) DROP Which aggregate function in SQL displays the number of values in the specified column ignoring the NULL values ? (A) len() @®) count() (C) number () ©) aum() In MYSQL, which type of value should not be enclosed within quotation marks ? a (A) DATE (B) VARCHAR (C) FLOAT () cHAR 1 State True or False : s 6 rows and 3 columns, and table B has 5 rows and If table A ha 2 columns, the Cartesian product of A and B will have 30 rows and 5 columns. tworking devices is used to regenerate and Which of the following net transmit the weakened signal ahead ? 1 (A) Hub (B) Ethernet Card (D) Modem (C) Repeater 2 - Page 9 of 32 ~ P.T.O. i 18. Which of the following options is the correct protocol used for phone calls over the internet ? 1 (A) PPP @®) FTP (© HTTP () VoIP 19. Expand ARPANET. il Q. Nos. 20 and 21 are Assertion (A) and Reason (R) based questions. Mark the correct choice as (A) Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A). (B) Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A). (C) Assertion (A) is true but, Reason (R) is false. (@) Assertion (A) is false but, Reason (R) is true. For a binary file opened using ‘xb’ mode, the ee i 20. Assertion (A) : pickle. dump () method will display an error. 1 Reason (R) : The pickle .dump() method is used to read from a binary file. 1, Assertion (A) \s1Wercanszotrieve ecuris|tromunors than one table in MYSQL. a Reason(R) : Foreign key is used to establish a relationship between two tables. a P.T.O. Page 11 of 32 oe 22. 24 25. @; ae SECTION -B (7x 2=14) What does the xeturn statement do in a function ? Explain with the help (i) Syntax Error (ii) Implicit Type Conversion Consider the following dictionaries, D and D1 : D=. Suma: 40, "Raj":55, "Raman": 60} Di=("Aditi":30, "Amit":90,"Raj":20) (Answer using built-in Python functions only) (i) (a) Write a statement to display/return the value corresponding to the key "Raj" in the dictionary D. OR (b) Write a statement to display the length of the dictionary D1. (ii) (a) Write a statement to append all the key-value pairs of the dictionary D to the dictionary D1. OR (b) Write a statement to delete the item with the given key "Amit" from the dictionary D1. of an example, 2 Write one example of each of the following in Python : 2 \ ' s ' What possible output from the given options is expected to be displayed when the following code is executed ? 2 import random Cards=["Heart" ,"Spade" ,"Club", "Diamond"] for i in range (2): print (Cards [random.randint (1,i+2)] yend="#") (A) Spade#Diamond# (B) Spade#Heart# (C) Diamond#Club# (D) Heart#Spade# Page 13 of 32 ~' Pino. 91 NL 26. 27. 28, The code giy, sum of ice below accepts N as an integer argument and returns the ‘Bers from 1 to N, Observe the following code carefully and rewrite it after re corrections made." #ll syntax and logical errors. Underline alll the , def sum(n) for T in range): S=S+r return s print (Sum(10) Nisha i, i ph = a assigned the task of maintaining the staff data of an 8 a on. She has to store the details of the staff in the SQL table named EMPLOYEES with attributes as EMPNO, NAME, DEPARTMENT, BASICSAL to store Employee's Identification Number, Name, Department, and Basic Salary respectively. There can be two or more Employees with the same name in the organization. 2 @ = (a) Help Nisha to identify the attribute which should be designated as the PRIMARY KEY. Justify your answer. OR (b) Help Nisha to identify the constraint which should be applied to the attribute NAME such that the Employees’ Names cannot be left empty or NULL while entering the records but can have duplicate values. (a) Write the SQL command to change the size of the attribute BASICSAL in the table EMPLOYEES to allow the maximum value of 99999 . 99 to be stored in it. OR (b) Write the SQL command to delete the table EMPLOYEES. Gi) Expand and explain the term URL. OR the term PPP. What is the use of PPP ? Page 15 of 32 ~ ay (a) (b) Expand 91 ee 2 @ (b) 30. (a) SECTION -c (3x3=9) Write a Python functi oa fegunstion that displays all the lines containing the the file contains. @ text file "Elections. txt". For example, if ; In anelection m The candidate aie People vote to choose their representative. Normally, one pen, aa eee maximum share of votes stands elected. a to vote o1 The process of voti » re ing may vary with ti i Then theloutpilahanlivecn, ime and region. nan ic in Sean many people vote to choose their representative. ‘ormally, one person has to vote once. Writ OR a ea Python function that displays all the words starting and ending with a vowel from a text file "Report.txt". The consecutive words should be separated by a space in the output. For example, if the file contains : Once there was a wise man ina village. He was an awesome story-teller. He was able to keep people anchored while listening to him. Then the output should be : Once a a awesome able A stack, named ClrStack, contains records of some colors. Hach record is represented as a tuple containing four elements — ColorName, RED, GREEN, BLUE. ColorName is a string, and RED, GREEN, BLUE are integers. For example, a record in the stack may be ('Yellow', 237, 250, 68) 8x1=3 Write the following user-defined functions in Python to perform the i i sk: specified operations on ClrStac: : ; a ush Clr(ClrStack, new_Clr): This function takes the Pack cirétack and a new record new_Clr as arguments and is new record onto the stack. Peer This function pops the topmost record ii tack) : e. a ae yeturns it. If the stack is already empty, the from. i isplay the message "Underflow". apa oe ‘This function checks whether the stack Cael cabbage js empty, the function should return | i tion should return False. therwise the func True, 0 OR Page 17 of 32 = . Biol 31. o) (a) Write the w@ Gi) ii) Push_treaiy lefined functions in Python : MYStACK repre TeACK) : Hore W and mystack are lists, and 5 elements on “stack, The function should push the last example, if the iat est ¥ onto the stack mystack. For Push_traii() : Nis (1,2,3,4,5,6,71, then the function stack, Theron nould Push the elements 34,5, 6,7 onto the “tore the value of stack will be [3,4,5,6,7]- Aseume that w contains at least 6 élemonta, Pop_one (myStack) : from the stack mystac is empty, following User, The function should pop an element k, and return this element. If the stack then the function should display the message 'Stack Underflow', and return None. display_all(mystack): The function should display all the elements of the stack myStack, without deleting them. If the stack is empty, the function should display the message ‘Empty Stack'. Predict the output of the following code : 3 def ExamOn (mystr) for i in mystr if counts2 != 0: newstr = newstr + str(count-1) else: newstr = newstr + i.lower() count += 1 newstr = newstr + mystr[:2] vmhe new stzing is:", newstr) print ( Examon ("GenX") OR Page 19 of 32 , a SS @ Write the output ne & ee def "Ut lef Change (x). On of the following Python code: cone vine F L1.ay “Atems() : 'PPend (x) 22. appena yy D={1: "ONE" 9.5 L1=[] + "THREE" } L2=[] Change (D) print (L1) print (L2) print (D) {= 1 6) SECTION -D (4x4=16) eI o Suman has created a table named WORKER with a set of records to a maintain the data of the construction sites, which consists of WID, D. After creating the table, WNAME, WAGE, HOURS, TYPE, and SITE she entered data in it, which is as follows : WID WNAME | WAGE | HOURS TYPE SITEID wo1 |ahmea g | 1500} 200 Unskilled ¢ 103 - Srl waveas |S ||) 540s. \e30o skilled 101 780 | 9 Unskilled 7 | 101 B | apes zee | | ligemiskilled | NOLL wece? te 110 WL 1K 560 [ee ea 5 ee acl 2 | grilled 103 1 a Wlo |anju S$ [eee eee real P.T.O. Based on the data @. ; Biven ab, a e ee ae I ears the following questions : ii) Writ CFS Whose Wages >, t*Play the names and wages of Relibke the SQL statema., tween 800 and 1500. S r L aii) Rai ee is not lee to display the record of workers i , eee cl thon © SQL statement to ai i © Workers Whose mypy a Puay WHAME, WAGE and HOURS of 1s 'Skilled'. (iv) Write the s workers wh QL statement to change the ere the TYPR is "Semi ey: the WAGE to 1200 of the jemiskilled". OR Biven table WORKER, write th , e output on € SQL commands : @) SELECT WName SITEID = 103: WAGE*HOURS FROM WORKER WHERE i) Considering the above execution of the followin, (i) SELECT Count (pisrincr type) FROM WORKER; (ii) SELECT MAX (WAGE), MIN GROUP BY TYPE; (WAGE), TYPE FROM WORKER (iv) SELECT WNAME,SITEID FROM WORKER WHERE. TYPE="Unskilled" ORDER BY HOURS; Acsv file "P_record.csv" contains the records of patients in a hospital. ! Each record of the file contains the following data : 4 4 + Name ofa patient + Disease + Number of days patient is admitted * Amount For example, a sample record of the file may be : mi jan"," ice" ,4,15000] at ions to perform the specified operations: Write the following Python functions '0 P on this file : ; OF cual () Write a function read_data() ee fle and display the detail oF ounts and returns the i col i) Write a function count_ree i number of records i the fle. s eral Page 23 of 32 me that you ar Asst) © Working ; (CAG), whi ing allerY ), which sells ee the I p, ulptures etc. The data of rent, forms ‘ePartment of a Creative Art ticles and Artist, 4 these two tables ; art creations like Paintings, , ieee are kept in tables ing are few records from 4x1=4 s Yeation, Tespectively pe | sc0o28 | aoooa | gx005 | A0003 r 140001 | Ro ; j 40003 | Roy =| 595923 xeCeAG.com | 1986-10-21 | 20002 |Ghosh 11122334 | ghosh@craG. com! 1972-02-0 1 1 i - 1 | x0003 jGargi | 121212 | Gargi@Crac. com! 1996-03-2 i ; Mustafa | 33333333 |Mf@CrAg.com | 2000-01-0: Note: @ The tables contain many more records than shown. here. © DOC is Date of Creation of an Article. As an employee of CAG, you are required to write the SQL queries for the following : () To display all th order of price. 7 r i re created in the year i) To display the details of Articles which we 2020. . fartists table. (iii) To display the structure o va woe Axtile is Painting (iv) (a) To display the e records from the Articles table in descending name of all artis through Equi Join. ies he name of all ‘Artists whose [Article is Painting! (b) To display the ™ h Natural Join 1 i rs . page 25 0! 91 j char (5) | varchar (15) i ; i ' varchar (15) ! {Varchar(is) | jane ' ie = at Delete, teatie (), to input the value of th_1D from nitly delete the corresponding record from the table. Assume the following for Python-Database connectivity : Host : localhost, User: xoot, Password : Ex2025 SECTION - 5 (2x5 =10) A file, PASSENGERS.DAT, stores the records of passengers using the following structure : 5 [PNR, PName, BRDSTN, DESTN, FARE] where : PNR - Passenger Number (string type) PName - Passenger Name (string type) BRDSTN - Boarding Station Name (string type) DESTIN - Destination Station Name (string type) FARE - Fare amount for the journey (float type) Write user defined functions in Python for the following tasks : (i) Create() —to input data for passengers and write it in the binary file PASSENGERS . DAT. (ii) SearchDestn (D) — to read contents from the file PASSENGERS . DAT and display the details of those Passengers whose DESTN matches with the value of D. (iii) UpdateFare()— to increase the fare of all passengers by 5% and rewrite the updated records into the file PASSENGERS . DAT. Page 27 of 32 7 P.T.O. ee gwabhaav’ is a big NGO wor god Counselling, h; following parameters in mind : Vijayawada Center —, Vijayawada Hi % pre Hoan cute field of Psychological Treatment gp acenter in Vijayawada. ‘The ADMIN, PSYCHIATRY, pgyey Bxpert, need to suggest the be, resolve the issues/probleme men Center will have four blo cks — pes and ICU. You, as a Network network-related solutions for them to tioned in questions (i) to (v), keeping the PSYCHIATRY Block PSYCHOLOGY Block IcU Block 5x1=5 Block to Block distances (in metres) : | From To Distance | ADMIN: PSYCHIATRY | 65 m ADMIN PSYCHOLOGY | 65 m ADMIN rcu 65m PSYCHIATRY | PSYCHOLOGY |100 m PSYCHIATRY | ICU 50 m PSYCHOLOGY | ICU 50 m Distance of Nagpw Number of Computer: r Head Office from Vijayawada Center = 700 km 91 Block No. of Computers ADMIN 16 PSYCHIATRY 40 PSYCHOLOGY 19 | Icu 20 Page 29 of 32 s in each block is as follows : 9% P.T.O. ————— @ @ (ii) (iv) () Suggest the most appropriate ze locati ids Vijayawada Center, cee awaae of the server inside the Which hardware device wi ice will you sug ee gest to connect all the computers within each block of ‘Vijayawada Center ? Draw a cable layout to efficiently connect various blocks within the Vijayawada Center, Where should the router be placed to provide internet to all the computers in the Vijayawada Center ? (@) The Manager at Nagpur wants to remotely access the computer in Admin block in Vijayawada. Which protocol will be used for this ? OR (b) Which type of Network (PAN, LAN, MAN or WAN) will be set ‘up among the computers connected with Vijayawada Center 2 Page 31 of 32 2

You might also like