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
Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?
Anonymous Quiz
6%
a) 3
28%
b) 5
28%
c) 25
39%
d) 1
Suppose list1 is [1, 5, 9], what is sum(list1)?
Anonymous Quiz
5%
a) 1
16%
b) 9
53%
c) 15
26%
d) Error
Pointer variable is used to hold the _________ of the variable.
Anonymous Quiz
11%
a) Value
61%
b) Address
28%
c) Value and Address
0%
d) Name of the variable
Which among the given operators is referred to as ‘address of’ operator?
Anonymous Quiz
16%
a) *
26%
b) ^
47%
c) &
11%
d) ~
Which among the following is referred as an array of pointers?
Anonymous Quiz
30%
a) int *p;
35%
b) int (*)p;
20%
c) int p[4];
15%
d) int*[4] p;
Among the given pointer which of the following cannot be incremented?
Anonymous Quiz
5%
a) int
26%
b) char
21%
c) float
47%
d) void
How many values can be returned from a function simultaneously using pointers?
Anonymous Quiz
15%
1
40%
2
10%
3
35%
as many as user wants