CS_QP_SET-3
CS_QP_SET-3
CS (SET-3)
Instructions:
Page 1 of 12
a. -a-ssistance
b. -a-ssist-nce
c. a-ssist-nce
d. -a-ssist-ance
8 Write a python dictionary named record with keys 12101, 12102, 12103 and 1
corresponding values as ‘krishna’ , ’prarabdh’ , ’shorya’ respectively.
9 Which of the following types of table constraints will prevent the entry of 1
duplicate rows and NULL value?
a. unique
b. distinct
c. not null
d. primary key
Page 2 of 12
print('You Cannot divide by zero')
except ValueError:
print('Invalid Input')
except:
print('An error occurred')
finally:
print('The end of the program')
divide(10,0)
a. You Cannot divide by zero
Invalid Input
An error occurred
The end of the program
b. You Cannot divide by zero
Invalid Input
The End of the program
c. You Cannot divide by zero
An error occurred
The end of the program
d. You Cannot divide by zero
The end of the program
Page 3 of 12
1
13
A table has initially 5 columns and 8 rows. Consider the following sequence of
operations performed on the table –
i. 8 rows are added
ii. 2 columns are added
iii. 3 rows are deleted
iv. 1 column is added
What will be the cardinality and degree of the table at the end of above
operations?
a. 8,13 b. 13,8 c. 14,5 d. 5,8
Page 4 of 12
Q20 and 21 are ASSERTION AND REASONING 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 the arguments in a function call statement match the number 1
and order of arguments as defined in the function definition, such arguments are
called positional arguments.
Reasoning (R):- During a function call, the argument list first contains default
argument(s) followed by positional argument(s).
21 Assertion (A): In SQL, the aggregate function avg() calculates the average value 1
on a set of values and produces a single result.
Reason (R): The aggregate functions are used to perform some fundamental
arithmetic tasks such as min(), max(), sum() etc
24 A. Write the python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
1. To check whether all the characters in the string S1 are digits or not.
2. To delete the elements from index no 3 to 7 in the list L1.
OR
Page 5 of 12
B. Consider the following list exam and write python built in function for the
following questions
Exam=[‘hindi’,’english’,’maths’,’science’]
1. To insert subject ‘computer science’ as last element.
2. To sort the list in reverse alphabetical order.
26 Rewrite the following Python program after removing all the syntactical errors 2
(if any), underlining each correction:
def checkval:
x = input("Enter a number")
if x % 2 =0:
print (x, "is even")
elseif x<0:
print (x, "should be positive")
else:
print (x, "is odd")
Page 6 of 12
27 2
1. In a database there is a table cabinet. The data entry operator is not able
to put NULL in a column of cabinet? what may be the possible reason(s)?
2. In a database there is a table cabinet. The data entry operator is not able
to insert duplicate values in a column of cabinet ? what may be the
possible reason(s)?
OR
1. There is a column C1 in a table T1. The following two statements
Select count(*) from T1; and Select count(C1) from T1;
Are giving different outputs. What may be the possible reason?
2. How are NULL values treated by aggregate functions?
30 Mr.Ajay has created a list of elements. Help him to write a program in python with 3
functions, PushEl(element) and PopEl() to add a new element and delete an
element from a List of elements, considering them to act as push and pop
operations of the Stack data structure. Push the element into the stack only when
the element is divisible by 4.
For eg:if L=[2,5,6,8,24,32]
then stack content will be 32 24 8
Page 7 of 12
OR
Tushar received a message(string) that has uppercase and lowercase letters. He
wants to extract all the upper case letters from the string and push them into a
stack. Help him to do this task by performing the following user defined functions
in python.
a. Push the uppercase alphabets of the string into a stack.
b. Pop and display the content of the stack. Once the stack is empty it should
display the message ‘End of Stack’
For example: If the message is
“All the Best for your Pre-Board Examination”
The output should be: EBPBA
End of Stack
Page 8 of 12
j=j+2
else:
j=j+3
print(s [ j : : j ] )
33 A csv file events.csv contains the details of events organized by firm M/s 4
MakeMyEvents. Each record of the file contains the following data
Id of the Event
Page 9 of 12
Event description
Venue of the event
Total No of Guest invited
Total cost of organizing the event
Write the following functions in Python to perform the specific operations on this
file :
(i) Search( ) – To display the details of those events having more than
1000 guests.
(ii) CountR( ) – To calculate and display the average cost of event.
• Assume the first row of the file event.csv have headers
For example
Event_id Description Venue Guests Cost
1001 Birthday BigBites 250 150000
1002 Marriage RajMandir 1100 1250000
Table : DEALERS
Dcode Dname Location
101 Vikash Stationers Lanka Varanasi
102 Bharat Drawing Emporium Luxa Varanasi
103 Banaras Books Corporation Bansphatak Varanasi
a. To display all the information about items containing the word “pen” in the
field Itname in the table STOCK.
b. List all the itname sold by Vikash Stationers.
c. List all the Itname and StkDate in ascending order of StkDate.
Page 10 of 12
d. List all the Itname, Qty and Dname for all the items for the items quantity
more than 40.
OR
e. List all the details of the items for which UnitPrc is more than 10
and <= 50.
35 Virat has created a table named TRAVELS in MySQL: 4
The fields of the table are
Tour_id-string
Destination – string
Geo_Cond=string
Distance-integer(In KM)
Note the following to establish connectivity between Python & MySQL :
UserName = root
Password=bharat
The table TRAVELS exists in a MYSQL database named TOUR.
Virat wants to display All records of TRAVELS relation whose Geographical
condition is hilly area and distance less than 1000 KM. Help Virat to write
program in python
37 TCS decided to open a new AI innovation center at Delhi. The center consists 5
of Five Buildings and each contains number of computers. The details are
shown below.
Building-2
Building-1 Building-3
Building-5 Building-4
Page 11 of 12
Distance between the buildings
Building No of computers
Building 1 and 2 20 Meters
1 40
Building 2 and 3 50 Meters
2 45
Building 3 and 4 120 Meters
3 110
Building 3 and 5 70 Meters
4 70
Building 1 and 5 65 Meters
5 60
Building 2 and 5 50 Meters
Computers in each building are networked but buildings are not networked so
far. The Company has now decided to connect building also.
I. Suggest a cable layout for connecting the buildings
II. Do you think anywhere Repeaters required in the campus? Why
III. The company wants to link this office to their head office at Mumbai
a. Which type of transmission medium is appropriate for such link?
b. What type of network would this connection result into?
IV. Where server is to be installed? Why?
V. Suggest the wired Transmission Media used to connect all buildings
efficiently.
OR
Which device will you suggest to be placed/installed in each of these buildings to
efficiently connect all the computers within these buildings.
Page 12 of 12