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

1 Answer

Answer :

a) [‘ab’, ‘cd’].

Related questions

Description : 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

Last Answer : d) none of the mentioned

Description : 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

Last Answer : c) error

Description : Let R be the rectangular window against which the lines are to be clipped using 2D Sutherland-Cohen line clipping algorithm. The rectangular window has lower left-hand corner at (-5,1) and upper righthand corner at (3,7). ... s) is/are candidate for clipping? (A) AB (B) CD (C) EF (D) AB and CD

Last Answer : (D) AB and CD

Description : 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

Last Answer : b) A B C D

Description : What is the output when following statement is executed ? >>>"abcd"[2:] a) a b) ab c) cd d) dc

Last Answer : c) cd

Description : 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

Last Answer : c) error

Description : 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

Last Answer : d) none of the mentioned

Description : What is the output of the following? x = 'abcd' for i in range(len(x)): x = 'a' print(x) Page No 17 a) a b) abcd abcd abcd c) a a a a d) none of the mentioned

Last Answer : c) a a a a

Description : What is the output of the following? print("xyyzxyzxzxyy".count('yy', 2)) a) 2 b) 0 c) 1 d) none of the mentioned

Last Answer : c)

Description : What is the output of the following? print("xyyzxyzxzxyy".count('yy', 1)) a) 2 b) 0 c) 1 d) none of the mentioned

Last Answer : a) 2

Description : What is the output of the following? print("xyyzxyzxzxyy".count('yy')) a) 2 b) 0 Page No 23 c) error d) none of the mentioned

Last Answer : a) 2

Description : What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for i in d: print(i) Page No 18 a) 0 1 2 b) a b c c) 0 a 1 b 2 c d) none of the mentioned

Last Answer : a) 0 1 2

Description : 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

Last Answer : b) 0 1 2

Description : 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

Last Answer : b) False

Description : 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

Last Answer : d) none of the mentioned

Description : 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

Last Answer : a) 1 2 3 4 5 6

Description : What is the output of the following? i = 1 Page No 11 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

Last Answer : c) error

Description : The Karnaugh map for a Boolean function is given as The simplified Boolean equation for the above Karnaugh Map is (A) AB + CD + AB’ + AD (B) AB + AC + AD + BCD (C) AB + AD + BC + ACD (D) AB + AC + BC + BCD

Last Answer : (B) AB + AC + AD + BCD

Description : What is the output when following statement is executed ? >>> print(‘x\97\x98’) a) Error b) 97 98 c) x\97 d) \x97\x98

Last Answer : c) x\97

Description : 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

Last Answer : a) no output

Description : 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

Last Answer : d) error

Description : Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], which of the following is correct syntax for slicing operation? a) print(list1[0]) b) print(list1[:2]) c) print(list1[:-2]) d) all of the mentioned

Last Answer : d) all of the mentioned

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} a.clear() print(a) a) None b) { None:None, None:None, None:None} c) {1:None, 2:None, 3:None} d) { }

Last Answer : d) { }

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} b={4:"D",5:"E"} a.update(b) print(a) a) {1: ‘A’, 2: ‘B’, 3: ‘C’} b) Method update() doesn’t exist for dictionaries c) {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’, 5: ‘E’} d) {4: ‘D’, 5: ‘E’}

Last Answer : c) {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’, 5: ‘E’}

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} a.setdefault(4,"D") print(a) a) {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’}. b) None. c) Error.

Last Answer : a) {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’}.

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} print(a.setdefault(3)) a) {1: ‘A’, 2: ‘B’, 3: ‘C’} b) C c) {1: 3, 2: 3, 3: 3} d) No method called setdefault() exists for dictionary

Last Answer : b) C

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} print(a.get(5,4)) a) Error, invalid syntax b) A c) 5 d) 4

Last Answer : d) 4

Description : What is the output of the following piece of code? a={1:"A",2:"B",3:"C"} print(a.get(1,4)) a) 1 b) A c) 4

Last Answer : b) A

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} for i,j in a.items(): print(i,j,end=" ") a) 1 A 2 B 3 C b) 1 2 3 c) A B C d) 1:”A” 2:”B” 3:”C”

Last Answer : a) 1 A 2 B 3 C

Description : What will be the output? d = {"john":40, "peter":45} print(list(d.keys())) a) [“john”, “peter”]. b) [“john”:40, “peter”:45]. c) (“john”, “peter”) d) (“john”:40, “peter”:45)

Last Answer : a) [“john”, “peter”].

Description : What will be the output? numberGames = {} numberGames[(1,2,4)] = 8 numberGames[(4,2,1)] = 10 numberGames[(1,2)] = 12 sum = 0 for k in numberGames: sum += numberGames[k] print len(numberGames) + sum Page No 36 a) 30 b) 24 c) 33 d) 12

Last Answer : a) 30

Description : What will be the output? >>>my_tuple = (1, 2, 3, 4) >>>my_tuple.append( (5, 6, 7) ) >>>print len(my_tuple) a) 1 b) 2 c) 5 d) Error

Last Answer : c) 5

Description : What is the output when following code is executed ? names1 = ['Amir', 'Bear', 'Charlton', 'Daman'] names2 = names1 names3 = names1[:] names2[0] = 'Alice' names3[1] = 'Bob' sum = 0 for ls in (names1, names2, names3): ... if ls[1] == 'Bob': sum += 10 print sum a) 11 b) 12 c) 21 d) 22

Last Answer : d) 22

Description : What is the output when following code is executed ? >>>names = ['Amir', 'Bear', 'Charlton', 'Daman'] >>>print(names[-1][-1]) a) A b) Daman c) Error d) n

Last Answer : b) Daman

Description : What is the output of the following? print("xyyzxyzxzxyy".count('xyy', -10, -1)) a) 2 b) 0 c) 1 d) error

Last Answer : b) 0

Description : What is the output of the following? print("xyyzxyzxzxyy".count('xyy', 2, 11)) a) 2 b) 0 c) 1 d) error

Last Answer : b) 0

Description : What is the output of the following? print("xyyzxyzxzxyy".count('xyy', 0, 100)) a) 2 b) 0 c) 1 d) error

Last Answer : a) 2

Description : What is the output when following statement is executed ? >>>print('new' 'line') a) Error b) Output equivalent to print ‘new\nline’ Page No 22 c) newline d) new line

Last Answer : c) newline

Description : hat is the output when following code is executed ? >>>print r"\nhello" The output is a) a new line and hello b) \nhello c) the letter r and then hello d) error

Last Answer : d) error

Description : What is the output of the following? i = 0 while i < 3: Page No 15 print(i) i += 1 else: print(0) a) 0 1 2 3 0 b) 0 1 2 0 c) 0 1 2 d) error

Last Answer : b) 0 1 2 0

Description : 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

Last Answer : b) 2 4

Description : What is the output of the following? i = 1 while True: if i%2 == 0: break print(i) i += 2 a) 1 Page No 13 b) 1 2 c) 1 2 3 4 5 6 … d) 1 3 5 7 9 11 …

Last Answer : d) 1 3 5 7 9 11 …

Description : 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 10 11 12 13 14 15 …. d) error

Last Answer : d) error

Description : hat is the output of the following? i = 5 while True: if i%0O11 == 0: Page No 12 break print(i) i += 1 a) 5 6 7 8 9 10 b) 5 6 7 8 c) 5 6 d) error

Last Answer : b) 5 6 7 8

Description : What does the following command do? grep −vn abc x (A) It will print all of the lines in the file x that match the search string abc (B) It will print all of the lines in file x that do not ... (D) It will print the specific line numbers of the file x in which there is a match for string abc

Last Answer : (A) It will print all of the lines in the file x that match the search string “abc”

Description : Consider the following JAVA program: public class First { public static int CBSE (int x) { if (x < 100) x = CBSE (x +10); return (x - 1); } public static void main (String[] args){ System.out.print(First.CBSE(60)); } } What does this program print? (1) 59 (2) 95 (3) 69 (4) 99

Last Answer : (2) 95 

Description : On the upper layer of SSL, a protocol for initial authentication and transfer of encryption keys, called the ………………… A) SSL handshake protocol B) SSL authentication protocol C) SSL record protocol D) SSL cipher protocol

Last Answer : A) SSL handshake protocol

Description : Data Integrity control uses ................ (A) Upper and lower limits on numeric data. (B) Passwords to prohibit unauthorised access to files. (C) Data dictionary to keep the data (D) Data dictionary to find last access of data

Last Answer : (B) Passwords to prohibit unauthorised access to files.

Description : Which one of the following describes the syntax of prolog program ? I. Rules and facts are terminated by full stop (.) II. Rules and facts are terminated by semicolon (;) III. Variables names must start with upper case alphabets. ... alphabets. Codes : (A) I, II (B) III, IV (C) I, III (D) II, IV

Last Answer : (C) I, III

Description : Unix command to change the case of first three lines of file “shortlist” from lower to upper (1) $ tr ‘[a-z]’ ‘[A-Z]’ shortlist | head-3 (2) $ head-3 shortlist | tr ‘[a-z]’ ‘[A-Z]’ (3) $ tr head-3 shortlist ‘[A-Z]’ ‘[a-z]’ (4) $ tr shortlist head-3 ‘[a-z]’ ‘[A-Z]’

Last Answer : (2) $ head-3 shortlist | tr ‘[a-z]’ ‘[A-Z]’