puterScience-SQP Set421
puterScience-SQP Set421
Page 1 of 7
9 What will be output of following code: 1
X = 50
def funct(X):
X=2
funct (X)
print(“X is now:”, X)
a) X is now: 50 b) X is now: 2 c) Error d) None of the above
10 To read the next line from the file object fob, we can use: 1
a)fob.read(2) b) fob.read( ) c) fob.readline( ) d) fob.readlines( )
11 TCP/IP stands for 1
a) Transmission Communication Protocol / Internet Protocol
b)Transmission Control Protocol / Internet Protocol
c) Transport Control Protocol / Interwork Protocol
d)Transport Control Protocol / Internet Protocol
12 ______is a communication methodology designed to deliver electronic mail (E-mail) over 1
the internet.
(a) VoIP (b) HTTP (c) PPP (d) SMTP
13 Which is known as range operator in MySQL. 1
a) IN b) BETWEEN c) IS d) DISTINCT
14 If column “salary” of table “EMP” contains the dataset {10000, 15000, 25000, 10000, 1
25000}, what will be the output of following SQL statement?
SELECT SUM(DISTINCT SALARY) FROM EMP;
a) 75000 b) 25000 c) 10000 d) 50000
15 Which of the following functions is used to find the largest value from the given data in 1
MySQL?
a) MAX ( ) b) MAXIMUM ( ) c) LARGEST ( ) d) BIG ( )
16 Name the clause used in query to place the condition on groups in MySQL? 1
17 Raj is looking for some information about How Router works, for this he opens the browser 1
and typed the URL of requested site. In few moments he received the requested page on his
browser screen. Identify the type of protocol, used between Browser (Client) and Web Server
for the communication?
a. TCP/IP b) HTTP c) SMTP d) POP3
18 What does the finally block in Python error handling ensure? 1
a) It ensures the code within it will always execute, regardless of whether an exception occurs
or not.
b) It ensures the program will terminate if an exception occurs.
c) It ensures that the program will skip executing the code if an exception occurs.
d) It ensures that only the code within the finally block will execute if an exception occurs.
19 What is the return datatype of readlines() function? 1
a) string b) List c) Tuple d) Dictionary
Q20 and 21 are Assertion and Reasoning based questions.Mark the correct choice as
a) A is true R is false
b) A is false and R is true
c) Both A and R are correct and R is correct explanation of A
d) Both A and R are correct and R is not correct explanation of A
20 Assertion : The number of addresses used in IPv6 addressing method is 128 1
Reason : IPv6 address is a 128 bit unique address
Page 2 of 7
21 Assertion : Delete command is used to remove rows or records from table. 1
Reason : This command is used to remove records along with structure of the table from
database
SECTION B
22 Rewrite the following code after removing the syntactical error(if any).Underline each 2
correction:
X=input("Enter a Number")
If x % 2 =0:
for i range (2*x):
print i
loop else:
print "#"
23 Write two points of difference between Client side script and Server side script 2
OR
Write two advantages of Twisted pair cable.
24 Write the output of the following python code: 2
def func(b):
global x
print ('Global x=',x)
y=x+b
x=7
z=x-b
print ('Local x=' ,x)
print ('y=' ,y)
print ('z=' ,z)
x=5
func(10)
25 Write two features of return keywords. 2
26 Classify each of the following Web Scripting as Client Side Scripting and Server Side 2
Scripting :
(i) Java Scripting (ii) ASP (iii) VB Scripting (iv) JSP
27 a) Consider the code given below and fill in the blanks. 2
try:
f=open("Account.txt",'r')
except ………………:
print('File not found')
………..:
print("Finally execute program...")
OR
Write a Python program that opens a file and handles a IndexError exception if the file does
not exist.
28 Differentiate between equi join and cross join function in SQL with a example 2
OR
Categorize the following commands as DML or DDL
ALTER , UPDATE , DELETE , DESCRIBE
SECTION –C
29 Write two differences between Coaxial and Fiber transmission media. 3
OR
(a) Write the full forms the following:
Page 3 of 7
(i) FTP (ii) HTTPS
(b)Name the protocols which are used for sending and receiving emails?
30 Write a function show_word( ) in python to read the content of a text file 'words.txt' and 3
display the entire content in upper case. Example ,if the file contain
"I love my country ,i am proud to be indian"
Then the function should display the output as:
I LOVE MY COUNTRY ,I AM PROUD TO BE INDIAN
OR
Considering the content stored in file “CORONA.TXT”
O Corona O Corona
Jaldi se tum Go na
Social Distancing ka palan karona
sabse 1 meter ki duri rakhona
Lockdown me ghar me ho to
Online padhai karona
Write the output of following statements – f = open("CORONA.TXT")
sr1 = # to read first line of file
str2 = # to read next line of file
str3 = # to read remaining lines of file
31 a) Difference between WHERE and HAVING. 3
OR
b) Write down the syntax for the following tasks in MySQL:
1. Viewing the structure of a table
2. Adding a column in an existing table
SECTION D
32 Write SQL commands for the following queries based on the relation Teacher givenbelow: 4
Table: Teacher
No Name Age Departme nt Date_of_join Salary Sex
1 Jugal 34 Computer 10-01-1997 12000 M
2 Sharmila 31 History 24-03-1998 20000 F
3 Sandeep 32 Maths 12-12-1996 30000 M
4 Sangeeta 35 History 01-07-1999 40000 F
5 Rakesh 42 Maths 05-09-1997 25000 M
6 Shyam 50 History 27-06-1998 30000 M
7 ShivOm 44 Computer 25-02-1997 21000 M
8 Shalakha 33 Maths 31-07-1997 20000 F
(i) To show all information about the teacher of Computer department.
(ii) To list the names of all teachers with their date of joining in descending order.
(iii) Delete the record of teacher age greater than 45
(iv) Increase the salary of teachers by 15% whose department is history
OR
Write outputs for SQL queries (i) to (iii) which are based on the given table Passengers:
Table: Passengers
Pnr T_no P_name Sex Age CITY TravelDate
P011 11001 Puneet Kumar M 42 Delhi 2019-07-12
P022 11010 Kush arora M 39 Chandigarh 2014-03-30
P033 12201 Shweta Nagpal F 25 Madras 2014-12-30
P044 11011 Sumit Mishra M 32 Kolkata 2018-07-15
Page 4 of 7
P055 12021 Ashmita Sharma F 33 Delhi 2019-03-30
P066 12012 Vinny Sood F 35 Chandigarh 2017-12-17
P077 13013 Akshat Gupta M 30 Madras 2018-07-22
i. Select P_Name From Passengers Where Age>30;
ii. Select P_Name, City From Passengers Where P_Name Like ‘%A’ and Sex= ‘M’ ;
iii. Select Age From Passengers Where City= ‘Chandigarh’;
iv. Select Count(Distinct(City) From Passengers Group By City;
33 A list contains following records of students:[Adm_no,SName,DOB,Mobile] 4
Write the following user defined function to perform given operations on the stacknamed
'Admission':
i) PUSH() To insert an object containing admission number,student name and Mobile of the
students who's birth year is after 2008 to the stack. If stack holds more than 3 elements
show "stack is full"
ii) POP() To pop the object from the stack and display them in stack one by one.For
Example:
If the lists of students detail are : ["20221017","Guru","20-7-2008","9988779988"]
["20221018","Ragunath","06-8-2009","9977889988"]
["20221019","Jenifer","31-12-2007","9988996677"]
["20221020","Priya","21-10-2009","9966557864"]
The stack should contain ["20221017","Guru","9988779988"]
["20221018","Ragunath","9977889988"] ["20221020","Priya","9966557864"]
The output should contain ["20221017","Guru","9988779988"]
["20221018","Ragunath","9977889988"] ["20221020","Priya","9966557864"]
Stack is full
OR
Write a function in python, makepush(var) and makepop(var) ,to add a new variable and
delete a variable from list of variables description, considering them to act as push and pop
operations of the stack data structure.
34 In a Database company, there are two tables given below: 4
Page 5 of 7
35 Write code to connect to a MySQL database namely School and then fetch all those records 4
from table Student where grade is ' A' .
Rollno Name Marks Grade Section Project
101 RUHANII 76.8 A A PENDING
102 GEOGRE 71.2 B A SUBMITTED
103 SIMRAN 81.2 A B EVALUATED
104 ALI 61.2 B C ASSIGNED
105 KUSHAL 51.6 C C EVALUATED
106 ARSIYA 91.6 A+ B SUBMITTED
107 RAUNAK 32.5 F B SUBMITTED
Note the following to establish connectivity between Python and MySQL:
host = "localhost",
user = "root",
password = "tiger",
database = "School"
SECTION E
36 TellAbout Consultants are setting up a secured network for their office campus at Gurgaon for 5
their day-to-day office and web-based activities. They are planning to have connectivity
between three buildings and the head office situated in Mumbai. Answer the questions (i) to
(v) after going through the building positions in the campus and other details, which are given
below :
The given building blocks are named as Green, Blue and Red
(i) Suggest the most suitable place (i.e., building) to house the server of this organization.
Also give a reason to justify your suggested location.
(ii) Suggest the placement of the following devices with justification:
a) Repeater. b) Switch.
(iii) Suggest a cable layout of connections between the buildings inside the campus.
(iv) The organization is planning to provide a high speed link with its head office situated in
Page 6 of 7
Mumbai using a wired connection. Which of the following cables will be most suitable for
this job.
a) Optical Fiber b) Co-axial Cable c) Ethernet Cable
(v) While connecting the devices two modems are found to be defected. What is the
function of modem?
37 Mr. Mathew is a Python programmer. Who has recently joined the company and given at ask 5
to write a python code to perform update operation in binary file (stud.dat) which contain
admno (Admission no) ,name , gender and salary (salary paid by employee).
(i) Write Python function AddEmp() to add few records.
(ii) Write Python code to create function showAll() those salary less than 60000.
Page 7 of 7