Page 5 - PYTHON-12
P. 5
5. Rahul wants to give a command to count non-existing value in commission attribute of staff table in
MySQL. Help him complete the command: (1)
select count(commission) from staff where ________________;
Ans. Select count(commission) from staff where commission is NULL;
6. Which of the following is not a network device? (1)
(a) Firewall
(b) Router
(c) Bridge
(d) Gateway
Ans. (a) Firewall
7. Consider a Dictionary of months and number of days: (1)
D={"January":31,"Feburary":28,"March":31,"April":30,
"May":31,"June":30,"July":31,"August":31,"September":30,
"October": 31,"November":30,"December":31}
Give command to:
(a) Display all the months
(b) Display all the days
Ans. (a) D.keys()
(b) D.values()
8. Give the output of the following program segment: (1)
x="hello World"
print(x[:-2])
print(x[-2:])
Ans. hello Wor
ld
9. Consider a tuple of marks of students, T=(78,89,90,44,89,95,39,45,78,44). Give command
to: (1)
(a) Display average of tuple T
(b) Display how many students scored 89 marks
Ans. (a) print(sum(T)/len(T))
(b) print(T.count(89))
10. In the context of Python-Database connectivity, rowcount is a/an— (1)
(a) attribute
(b) method
(c) object
(d) literal
Ans. (a) attribute
11. Identify the domain name and URL from the following: (1)
http://www.helpingeachother.in/aboutus.htm
Ans. Domain name:helpingeachother.in
URL:www.helpingeachother.in/aboutus.htm
12. Is the following code correct? If yes, what will be the output of the following code? (1)
s="-". join(("one","two","three"))
print(s)
Ans. No error
Output: one-two-three
13. “Trying to add an element to a full stack results in an exception termed as Overflow.” (True or False) (1)
Ans. True
A.30 Computer Science with Python–XII