NEW
Font size
WorksheetsDECODEX
Total questions: 25
Worksheet time: 8mins
What will this code print?
printf("%d", printf("CQuiz"));
CQuiz
CQuiz5
5
Compilation Error
What is a generator function?
A function that returns a list
A function that uses yield
A function that returns all values at once
A normal function
What is the result of sum([[]])?
0
[]
Error
None
Which of the following is immutable?
list
set
dictionary
tuples
What is the output of:
def gen():
for i in range(3):
yield i
g = gen()
print(next(g), next(g))
0 1
1 2
0 1 2
error
Which statement is used to handle exceptions in Python?
catch
error
try-except
handle
What is the purpose of a decorator in Python?
to decorate strings
To modify the behavior of functions
To add colors to output
To create loops
What will this print?
def sumDigits(n):
if n == 0:
return 0
return n % 10 + sumDigits(n // 10)
print(sumDigits(123))
123
6
3
Error
Who owns the internet?
Internet Engineering Task Force
ICANN
Internet Architecture Board
None
What is the output of sizeof('A') in C?
1
2
4
Depends on compiler
What happens if a subclass defines an init method but does not call super().init()?
The parent’s constructor runs automatically
The parent’s constructor is skipped
Syntax error
Parent and child constructors both run
Which operator has the highest precedence in C?
++
*
()
sizeof
What is the output of:
def addToList(val, lst=[]):
lst.append(val)
return lst
print(addToList(1))
print(addToList(2, []))
print(addToList(3))
[1] [2] [3]
[1] [2] [1, 3]
[1, 2, 3]
[1] [2, 3] [1, 3]
What is Python’s duck typing principle?
Type checking at compile time
Type checking based on variable name
If an object behaves like a type, it’s treated as that type
Python rejects objects of unknown types
Which of these is not a web server?
Apache
IIS
Jigsaw
Zaob
What will be the output of the following code?
x = [[0]*3]*3
x[0][0] = 1
print(x)
[[1, 0, 0], [0, 0, 0], [0, 0, 0]]
[[1, 0, 0], [1, 0, 0], [1, 0, 0]]
[[1, 1, 1], [0, 0, 0], [0, 0, 0]]
error
What is the default value of a global variable in C?
0
garbage value
NULL
depends on compiler
Which was the first browser?
WorldWideWeb
Netscape Navigator
Internet Explorer
Safari
Which of the following is not a valid macro definition?
#define SQR(x) (x*x)
#define MAX 100
#define x = 10
#define PI 3.14
What is the output?
a = [1, 2, 3]
print(list(map(lambda x: x**2, a)))
[1, 4, 9]
[2, 3, 4]
[1, 2, 3]
Error
Which company is named "Big Blue"
TCS
IBM
Microsoft
Sathayam
What will ''.join(['a', 'b', 'c']) return?
['a', 'b', 'c']
abc
'abc'
a,b,c
Its a small peice of text stored in the user's computer by the user for maintaining the state. What is it?
Application
Session
Cookie
QueryString
Which of these is the first web based e-mail service?
Gmail
Yahoo mail
Hotmail
Rediff mail
Which of these is a correct format of IP address?
192.168.1.1
192.168.111.111
192.168.900.1
192.900.168.1
