Which of the following is not a WebSocket event?
Anonymous Quiz
8%
a) open
54%
b) close
31%
c) error
8%
d) deny
What does the following JavaScript code snippet do?
var httpserver = new http.Server();
var httpserver = new http.Server();
Anonymous Quiz
21%
a) Create an HTTP Server
43%
b) Create HTTP Connection between Client and Server
21%
c) HTTP Server & Connection
14%
d) Create a connection between two servers
Which of the following is not a socket property?
Anonymous Quiz
15%
a) onopen
31%
b) readyState
38%
c) onmessage
15%
d) ready
How does the client and the server communicate following the rules defined by the WebSocket protocol?
Anonymous Quiz
14%
a) Long-lived TCP Socket
50%
b) Short-lived TCP Socket
29%
c) UDP Socket
7%
d) HTTP Socket
To check whether string s1 contains another string s2, use ________
Anonymous Quiz
6%
a) s1.__contains__(s2)
50%
b) s2 in s1
39%
c) s1.contains(s2)
6%
d) si.in(s2)
Suppose i is 5 and j is 4, i + j is same as ________
Anonymous Quiz
18%
a) i.__add(j)
65%
b) i.__add__(j)
12%
c) i.__Add(j)
6%
d) i.__ADD(j)
What function do you use to read a string?
Anonymous Quiz
37%
a) input(βEnter a stringβ)
32%
b) eval(input(βEnter a stringβ))
32%
c) enter(βEnter a stringβ)
0%
d) eval(enter(βEnter a stringβ))
Suppose x is 345.3546, what is format(x, β10.3fβ) (_ indicates space).
Anonymous Quiz
25%
a) __345.355
38%
b) ___345.355
31%
c) ____345.355
6%
d) _____345.354
What will be the output of the following Python code?
print("abc DEF".capitalize())
print("abc DEF".capitalize())
Anonymous Quiz
0%
a) abc def
75%
b) ABC DEF
6%
c) Abc def
19%
d) Abc Def
What will be the output of the following Python code?
print("abc. DEF".capitalize())
print("abc. DEF".capitalize())
Anonymous Quiz
0%
a) abc. def
56%
b) ABC. DEF
31%
c) Abc. def
13%
d) Abc. Def
What will be the output of the following Python code?
print("abcdef".center(0))
print("abcdef".center(0))
Anonymous Quiz
7%
a) cd
40%
b) abcdef
40%
c) error
13%
d) none of the mentioned
What will be the output of the following Python code?
print('*', "abcdef".center(7), '*')
print('*', "abcdef".center(7), '*')
Anonymous Quiz
8%
a) * abcdef *
62%
b) * abcdef *
31%
c) *abcdef *
0%
d) * abcdef*
What will be the output of the following Python code snippet?
print('abcd'.translate('a'.maketrans('abc', 'bcd')))
print('abcd'.translate('a'.maketrans('abc', 'bcd')))
Anonymous Quiz
33%
a) bcde
58%
b) abcd
8%
c) error
0%
d) bcdd
What will be the output of the following Python code snippet?
print('abcd'.translate({97: 98, 98: 99, 99: 100}))
print('abcd'.translate({97: 98, 98: 99, 99: 100}))
Anonymous Quiz
23%
a) bcde
46%
b) abcd
23%
c) error
8%
d) none of the mentioned
What will be the output of the following Python code snippet?
print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))
print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))
Anonymous Quiz
38%
a) abcd
38%
b) 1234
19%
c) error
6%
d) none of the mentioned
xplanation: The function translate expects a dictionary of integers. Use maketrans() instead of doing the above.
9. What will be the output of the following Python code snippet?
print('ab'.zfill(5))
9. What will be the output of the following Python code snippet?
print('ab'.zfill(5))
Anonymous Quiz
27%
a) 000ab
36%
b) 00ab0
36%
c) 0ab00
0%
d) ab000
What will be the output of the following Python code snippet?
print('+99'.zfill(5))
print('+99'.zfill(5))
Anonymous Quiz
14%
a) 00+99
50%
b) 00099
14%
c) +0099
21%
d) +++99
Which of the following commands will create a list?
Anonymous Quiz
20%
a) list1 = list()
47%
b) list1 = []
33%
c) list1 = list([1, 2, 3])
0%
d) all of the mentioned
What is the output when we execute list(βhelloβ)?
Anonymous Quiz
27%
a) [βhβ, βeβ, βlβ, βlβ, βoβ]
53%
b) [βhelloβ]
20%
c) [βlloβ]
0%
d) [βollehβ]
Suppose listExample is [βhβ,βeβ,βlβ,βlβ,βoβ], what is len(listExample)?
Anonymous Quiz
50%
a) 5
38%
b) 4
13%
c) None
0%
d) Error
Suppose list1 is [2445,133,12454,123], what is max(list1)?
Anonymous Quiz
12%
a) 2445
18%
b) 133
71%
c) 12454
0%
d) 123