

MCQOPTIONS
Saved Bookmarks
This section includes 1007 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
851. |
What is the output of the following? d = {0, 1, 2} for x in d: print(d.add(x)) |
A. | 0 1 2 |
B. | 0 1 2 0 1 2 0 1 2 … |
C. | 0 1 2 0 1 2 0 1 2 … |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
852. |
What is the output of the following? d = {0, 1, 2} for x in d: print(x) |
A. | 0 1 2 |
B. | {0, 1, 2} {0, 1, 2} {0, 1, 2} |
C. | error |
D. | none of the mentioned |
Answer» B. {0, 1, 2} {0, 1, 2} {0, 1, 2} | |
853. |
What is the output of the following? d = {0, 1, 2} for x in d.values(): print(x) |
A. | 0 1 2 |
B. | None None None |
C. | error |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
854. |
What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x in d.values(): print(d[x]) |
A. | 0 1 2 |
B. | a b c |
C. | 0 a 1 b 2 c |
D. | none of the mentioned |
Answer» E. | |
855. |
What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x in d.keys(): print(d[x]) |
A. | 0 1 2 |
B. | a b c |
C. | 0 a 1 b 2 c |
D. | none of the mentioned |
Answer» C. 0 a 1 b 2 c | |
856. |
What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x, y in d.items(): print(x, y) |
A. | 0 1 2 |
B. | 0 1 2 |
C. | 0 a 1 b 2 c |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
857. |
What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x, y in d: print(x, y) |
A. | 0 1 2 |
B. | a b c |
C. | 0 a 1 b 2 c |
D. | none of the mentioned |
Answer» E. | |
858. |
What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for i in d: print(i) |
A. | 0 1 2 |
B. | a b c |
C. | 0 a 1 b 2 c |
D. | none of the mentioned |
Answer» B. a b c | |
859. |
What is the output of the following? x = 123 for i in x: print(i) |
A. | 1 2 3 |
B. | 123 |
C. | error |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
860. |
What is the output of the following? x = 'abcd' for i in range(len(x)): print(x) x = 'a' |
A. | a |
B. | abcd abcd abcd abcd |
C. | a a a a |
D. | none of the mentioned |
Answer» E. | |
861. |
What is the output of the following? x = 'abcd' for i in range(len(x)): x = 'a' print(x) |
A. | a |
B. | abcd abcd abcd |
C. | a a a a |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
862. |
What is the output of the following? x = 'abcd' for i in range(len(x)): i[x].upper() print (x) |
A. | abcd |
B. | ABCD |
C. | error |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
863. |
What is the output of the following? x = 'abcd' for i in range(len(x)): x[i].upper() print (x) |
A. | abcd |
B. | ABCD |
C. | error |
D. | none of the mentioned |
Answer» B. ABCD | |
864. |
What is the output of the following? x = 'abcd' for i in range(len(x)): i.upper() print (x) |
A. | a b c d |
B. | 0 1 2 3 |
C. | error |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
865. |
What is the output of the following? x = 'abcd' for i in range(len(x)): print(i.upper()) |
A. | a b c d |
B. | 0 1 2 3 |
C. | error |
D. | 1 2 3 4 |
Answer» D. 1 2 3 4 | |
866. |
What is the output of the following? x = 'abcd' for i in range(len(x)): print(i) |
A. | a b c d |
B. | 0 1 2 3 |
C. | error |
D. | 1 2 3 4 |
Answer» C. error | |
867. |
What is the output of the following? x = 'abcd' for i in range(x): print(i) |
A. | a b c d |
B. | 0 1 2 3 |
C. | 0 1 2 3 |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
868. |
What is the output of the following? x = 'abcd' for i in x: print(i.upper()) |
A. | a b c d |
B. | A B C D |
C. | a B C D |
D. | error |
Answer» C. a B C D | |
869. |
What is the output of the following? x = 'abcd' for i in x: print(i) x.upper() |
A. | a B C D |
B. | a b c d |
C. | A B C D |
D. | error |
Answer» C. A B C D | |
870. |
What is the output of the following? x = "abcdef" i = "a" while i in x[1:]: print(i, end = " ") |
A. | a a a a a a |
B. | a |
C. | no output |
D. | error |
Answer» D. error | |
871. |
What is the output of the following? x = "abcdef" i = "a" while i in x: x = x[1:] print(i, end = " ") |
A. | a a a a a a |
B. | a |
C. | no output |
D. | error |
Answer» C. no output | |
872. |
What is the output of the following? x = "abcdef" i = "a" while i in x[:-1]: print(i, end = " ") |
A. | a a a a a |
B. | a a a a a a |
C. | a a a a a a … |
D. | a |
Answer» D. a | |
873. |
What is the output of the following? x = "abcdef" i = "a" while i in x: x = x[:-1] print(i, end = " ") |
A. | i i i i i i |
B. | a a a a a a |
C. | a a a a a |
D. | none of the mentioned |
Answer» C. a a a a a | |
874. |
What is the output of the following? x = "abcdef" i = "a" while i in x: print('i', end = " ") |
A. | no output |
B. | i i i i i i … |
C. | a a a a a a … |
D. | a b c d e f |
Answer» C. a a a a a a … | |
875. |
What is the output of the following? x = "abcdef" i = "a" while i in x: print(i, end = " ") |
A. | no output |
B. | i i i i i i … |
C. | a a a a a a … |
D. | a b c d e f |
Answer» D. a b c d e f | |
876. |
What is the output of the following? x = "abcdef" i = "i" while i in x: print(i, end=" ") |
A. | no output |
B. | i i i i i i … |
C. | a b c d e f |
D. | abcdef |
Answer» B. i i i i i i … | |
877. |
What is the output of the following? x = "abcdef" while i in x: print(i, end=" ") |
A. | a b c d e f |
B. | abcdef |
C. | i i i i i i … |
D. | error |
Answer» E. | |
878. |
What is the output of the following? i = 0 while i < 3: print(i) i += 1 else: print(0) |
A. | 0 1 2 3 0 |
B. | 0 1 2 0 |
C. | 0 1 2 |
D. | error |
Answer» C. 0 1 2 | |
879. |
What is the output of the following? i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0) |
A. | 0 1 2 0 |
B. | 0 1 2 |
C. | error |
D. | none of the mentioned |
Answer» C. error | |
880. |
What is the output of the following? True = False while True: print(True) break |
A. | True |
B. | False |
C. | None |
D. | none of the mentioned |
Answer» E. | |
881. |
What is the output of the following? i = 1 while False: if i%2 == 0: break print(i) i += 2 |
A. | 1 |
B. | 1 3 5 7 … |
C. | 1 2 3 4 … |
D. | none of the mentioned |
Answer» E. | |
882. |
What is the output of the following? i = 2 while True: if i%3 == 0: break print(i) i += 2 |
A. | 2 4 6 8 10 … |
B. | 2 4 |
C. | 2 3 |
D. | error |
Answer» C. 2 3 | |
883. |
What is the output of the following? i = 1 while True: if i%2 == 0: break print(i) i += 2 |
A. | 1 |
B. | 1 2 |
C. | 1 2 3 4 5 6 … |
D. | 1 3 5 7 9 11 … |
Answer» E. | |
884. |
What is the output of the following? i = 5 while True: if i%0O9 == 0: break print(i) i += 1 |
A. | 5 6 7 8 |
B. | 5 6 7 8 9 |
C. | 5 6 7 8 9 |
D. | error |
Answer» E. | |
885. |
What is the output of the following? i = 5 while True: if i%0O11 == 0: break print(i) i += 1 |
A. | 5 6 7 8 9 10 |
B. | 5 6 7 8 |
C. | 5 6 |
D. | error |
Answer» C. 5 6 | |
886. |
What is the output of the following? i = 1 while True: if i%0O7 == 0: break print(i) i += 1 |
A. | 1 2 3 4 5 6 |
B. | 1 2 3 4 5 6 7 |
C. | error |
D. | none of the mentioned |
Answer» B. 1 2 3 4 5 6 7 | |
887. |
What is the output of the following? i = 1 while True: if i%3 == 0: break print(i) i + = 1 |
A. | 1 2 |
B. | 1 2 3 |
C. | error |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
888. |
What is the output of the following? x = ['ab', 'cd'] for i in x: x.append(i.upper()) print(x) |
A. | [‘AB’, ‘CD’]. |
B. | [‘ab’, ‘cd’, ‘AB’, ‘CD’]. |
C. | [‘ab’, ‘cd’]. |
D. | none of the mentioned |
Answer» E. | |
889. |
What is the output of the following? x = ['ab', 'cd'] for i in x: i.upper() print(x) |
A. | [‘ab’, ‘cd’]. |
B. | [‘AB’, ‘CD’]. |
C. | [None, None]. |
D. | none of the mentioned |
Answer» B. [‘AB’, ‘CD’]. | |
890. |
What is the output of the code shown below? def d(f): def n(*args): return '$' + str(f(*args)) return n @d def p(a, t): return a + a*t print(p(100,0)) |
A. | 100 |
B. | $100 |
C. | $0 |
D. | 0 |
Answer» C. $0 | |
891. |
What is the output of the code shown below? class A: @staticmethod def a(x): print(x) A.a(100) |
A. | Error |
B. | Warning |
C. | 100 |
D. | No output |
Answer» D. No output | |
892. |
dentify the decorator in the snippet of code shown below. def sf(): pass sf = mk(sf) @f def sf(): return |
A. | @f |
B. | f |
C. | sf() |
D. | mk |
Answer» E. | |
893. |
What are the output of the code shown below? def f(x): def f1(*args, **kwargs): print("*"* 5) x(*args, **kwargs) print("*"* 5) return f1 def a(x): def f1(*args, **kwargs): print("%"* 5) x(*args, **kwargs) print("%"* 5) return f1 @f @a def p(m): print(m) p("hello") |
A. | ***** %%%%% hello %%%%% ***** |
B. | Error |
C. | *****%%%%%hello%%%%%***** |
D. | hello |
Answer» B. Error | |
894. |
What is the output of the code shown below? def f(x): def f1(a, b): print("hello") if b==0: print("NO") return return f(a, b) return f1 @f def f(a, b): return a%b f(4,0) |
A. | hello NO |
B. | hello Zero Division Error |
C. | NO |
D. | hello |
Answer» B. hello Zero Division Error | |
895. |
What is the output of the following function? def f(p, q): return p%q f(0, 2) f(2, 0) |
A. | 0 0 |
B. | Zero Division Error Zero Division Error |
C. | 0 Zero Division Error |
D. | Zero Division Error 0 |
Answer» D. Zero Division Error 0 | |
896. |
What is the output of the code shown? def ordi(): print("Ordinary") ordi ordi() |
A. | Address Ordinary |
B. | Error Address |
C. | Ordinary Ordinary |
D. | Ordinary Address |
Answer» B. Error Address | |
897. |
The ______ symbol along with the name of the decorator function can be placed above the definition of the function to be decorated works as an alternate way for decorating a function. |
A. | # |
B. | $ |
C. | @ |
D. | & |
Answer» D. & | |
898. |
n the code shown below, which function is the decorator? def mk(x): def mk1(): print("Decorated") x() return mk1 def mk2(): print("Ordinary") p = mk(mk2) p() |
A. | p() |
B. | mk() |
C. | mk1() |
D. | mk2() |
Answer» C. mk1() | |
899. |
What is the output of the code shown below? def mk(x): def mk1(): print("Decorated") x() return mk1 def mk2(): print("Ordinary") p = mk(mk2) p() |
A. | Decorated Decorated |
B. | Ordinary Ordinary |
C. | Ordinary Decorated |
D. | Decorated Ordinary |
Answer» E. | |
900. |
What is the output of the two codes shown below? '{0}'.format(4.56) '{0}'.format([4.56,]) |
A. | ‘4.56’, ‘4.56,’ |
B. | ‘4.56’, ‘[4.56]’ |
C. | 4.56, [4.56,] |
D. | 4.56, [4.56,] |
Answer» C. 4.56, [4.56,] | |