CS QP 4
CS QP 4
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 the case of MCQ, the text of the correct answer should also be written.
Page 1 of 10
5. What will be the output of the following code snippet?
message= "World Health Organization" (1)
6. Which of the following lines will give error and why? Write None if there is no
error
t1=1,2 #line1
t2=t1 #Line2
t1 += 4 #line3 (1)
Page 2 of 10
12. What will be the output of the following code?
c = 10
def add():
c = 90
c=c+2
print(c,end='#')
add() (1)
print(c,end='%')
(A) 12%10#
(B) 12#12%
(C) 92#10%
(D) Syntax Error
13. Kangkana wants to ensure that a column must not contain duplicate values. (1)
However, the column may contain blank values. Which constraint should she
enable?
14. How many rows will the below query generate if the product has 4 rows and
orders has 3 rows?
SELECT * FROM products, orders;
(A) 12 (1)
(B) 7
(C) 4
(D) Error as there is no join condition
15. Which of the following commands is used to delete columns from a table?
(A) Delete <colname> from <tab name>
(B) Alter table <tabname> drop <colname>
(1)
(C) Drop <colname> from <tabname>
(D) Update <tabname> drop <colname>
16. Which of the following commands can change the cardinality of a table?
(A) Insert command
(B) Delete command (1)
(C) Update command
(D) Both A and B
17. ______________ provides access to virtual terminals of remote systems on local
area networks or the Internet.
(A) TELNET
(B) FTP (1)
(C) HTTP
(D) HTTPS
18. Which network device is used for broadcasting?
(A) Router
(B) Hub
(1)
(C) Switch
Page 3 of 10
(D) Repeater
19. Arindam wants to set up a cable connection within his own city. Which of the
following types of network (LAN/MAN/PAN/WAN) should he use? (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 and 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): If a function has a local variable with the same name as global
variable then global variable is accessed.
Reasoning (R): Local variables are the variables whose access is limited within (1)
the function body.
Assertion (A): The sequence of operations starting with select, where, group by,
21.
having and order by must be followed while writing a SQL query.
(1)
Reasoning (R): A Single Query may have where, group by, having, order by all at
the same time.
Q No Section-B (7 x 2=14 Marks) Marks
23. Given a list L=[12,78,91,43,12,11,91]. Write the build in user defined function to
(2)
a) Count the occurrence of 12 in the list.
b) Print the position of first occurrence of 91
Write a function to remove the duplicate elements from the main list and print
the list with unique elements.
Page 4 of 10
25. Write at least 2 possible output(s) for the following code.
import random
print(a[i],end='#')
26. Rao has written a code to input a number and check whether it is prime or not.
His code is having errors. Rewrite the correct code and underline the
corrections made.
if n%i=0:
break
else:
27. A. Differentiate between count () and count (*) functions in SQL with
appropriate examples.
OR
B. Survi mistakenly added ‘name’ as the primary key instead of ‘id’. Write the
code on behalf of Survi to add the ‘id’ as primary key for the table
employee. (2)
28. A. In this topology all devices are connected to a central hub or switch. Which
topology is being referred to here? Write one advantage and one
disadvantage for the same topology. (2)
OR
29. A. Write a method COUNTLINES () in Python to read lines from text file
‘TESTFILE.TXT’ and count the lines which are not starting with any vowel.
Example: (3)
If the file content is as follows:
An apple a day keeps the doctor away.
Page 5 of 10
We all pray for everyone’s safety.
A marked difference will come in our country.
OR
B. A school stores records of Class XII students using a list that contains
multiple lists as its elements. The structure of each such element is
[Student_Name, Marks, MainSubject]. Create user-defined functions to
perform the operations as mentioned below:
a. Push_student(): To push the Student_Name and Marks of all those
students, who have Science as MainSubject, into a Stack StudentInfo.
b. Pop_student(): To delete all items (one at a time) from the stack
StudentInfo in LIFO order and display them. Also display "Empty
Stack" when there are no items remaining in the stack.
For Example:
If the stored information is:
[['Akansha',98,"Mathematics"],["Priti",96,"Science"],["Garima",99,"Science"],
["Ayushi",78,"English"]]
The stack should contain:
["Garima",99]
["Priti",96]
Page 6 of 10
The output should be:
["Garima",99]
["Priti",96]
Empty Stack
32. A. Write the desired SQL Query to extract the below information.
OR
Radha Shah is a programmer, who has recently been given a task to write a python
33.
code to perform the following CSV file operations with the help of two user defined
functions/modules:
B. CSVRead (): to display the records from the CSV file called BOOKS.CSV
where the field title starts with 'Ra’.
34. Tejasvi Sethi, a car dealer, has stored the details of all cars in her showroom in a
table called CARMARKET. The table CARMARKET has attributes CARCODE which is a
primary key, CARNAME, COMPANY, COLOR, COST (in lakh rupees) of the car and
DOM which is the Date of Manufacture of the car.
Page 8 of 10
Write the SQL Query to display:
a) Car name that begins with I and ends with A
b) Total numbers of cars for each company
c) The latest DOM (Most recent) company wise
d) Display the average cost of each company where the average is less than 30
Lakhs.
OR(Alternative between d and e)
e) If we delete C04 and C02 and add C09 what is the revised Cardinality and
degree for the table.
35. Write the MYSQL connector python code to display details of those mobiles
whose price is greater than 8000 for the following table.
Table Name: Mobile
Database: Product
Host: localhost
Username: Root
Password: P123
(4)
36. Mouparna is a teacher working in a School. She needs to manage the record of
various students. For this, she wants the following information of each Student to
be stored:
- Roll – integer
- Name – string
- Class – integer
- Percentage – float (5)
Page 9 of 10
MakeInIndia Corporation, an Uttarakhand based IT training company, is planning to
37.
set up training centers in various cities in the next 2 years. Their first campus is
coming up in Kashipur district. At Kashipur campus, they are planning to have 3
different blocks for App development, Web designing and Movie editing. Each
block has some number of computers, which are required to be connected in a
Network for communication, data and resource sharing. As a network consultant of
this company, you have to suggest the best network related solutions for them for
issues/problems raised in question nos. (A) To (F), keeping in mind the distances
between various Blocks/locations and other given parameters.
(5)
*****
Page 10 of 10