Explore topic-wise MCQs in Technical Programming.

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.

701.

Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is :

A. [0, 1, 2, 3].
B. [0, 1, 2, 3, 4].
C. [0.0, 0.5, 1.0, 1.5].
D. [0.0, 0.5, 1.0, 1.5, 2.0].
Answer» D. [0.0, 0.5, 1.0, 1.5, 2.0].
702.

Suppose list1 is [1, 3, 2], What is list1 * 2 ?

A. [2, 6, 4].
B. [1, 3, 2, 1, 3].
C. [1, 3, 2, 1, 3, 2] .
D. [1, 3, 2, 3, 2, 1].
Answer» D. [1, 3, 2, 3, 2, 1].
703.

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
Answer» E.
704.

Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1] ?

A. [2, 33, 222, 14].
B. Error
C. 25
D. [25, 14, 222, 33, 2].
Answer» B. Error
705.

Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1] ?

A. Error
B. None
C. 25
D. 2
Answer» D. 2
706.

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
Answer» E.
707.

To shuffle the list(say list1) what function do we use ?

A. list1.shuffle()
B. shuffle(list1)
C. random.shuffle(list1)
D. random.shuffleList(list1)
Answer» D. random.shuffleList(list1)
708.

Suppose list1 is [1, 5, 9], what is sum(list1) ?

A. 1
B. 9
C. 15
D. Error
Answer» D. Error
709.

Suppose list1 is [3, 5, 25, 1, 3], what is min(list1) ?

A. 3
B. 5
C. 25
D. 1
Answer» E.
710.

Suppose list1 is [2445,133,12454,123], what is max(list1) ?

A. 2445
B. 133
C. 12454
D. 123
Answer» D. 123
711.

Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?

A. 5
B. 4
C. None
D. Error
Answer» B. 4
712.

What is the output when we execute list(“hello”)?

A. [‘h’, ‘e’, ‘l’, ‘l’, ‘o’].
B. [‘hello’].
C. [‘llo’].
D. [‘olleh’].
Answer» B. [‘hello’].
713.

Which of the following commands will create a list?

A. list1 = list()
B. list1 = [].
C. list1 = list([1, 2, 3])
D. all of the mentioned
Answer» E.
714.

What is the output of the following? print('+99'.zfill(5))

A. 00+99
B. 00099
C. +0099
D. +++99
Answer» D. +++99
715.

What is the output of the following? print('ab'.zfill(5))

A. 000ab
B. 00ab0
C. 0ab00
D. ab000
Answer» B. 00ab0
716.

What is the output of the following? print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))

A. abcd
B. 1234
C. error
D. none of the mentioned
Answer» B. 1234
717.

What is the output of the following? print('abcd'.translate({97: 98, 98: 99, 99: 100}))

A. bcde
B. abcd
C. error
D. none of the mentioned
Answer» E.
718.

What is the output of the following? print('abcd'.translate('a'.maketrans('abc', 'bcd')))

A. bcde
B. abcd
C. error
D. bcdd
Answer» E.
719.

What is the output of the following? print('ab cd-ef'.title())

A. Ab cd-ef
B. Ab Cd-ef
C. Ab Cd-Ef
D. None of the mentioned
Answer» D. None of the mentioned
720.

What is the output of the following? print('ab cd ef'.title())

A. Ab cd ef
B. Ab cd eF
C. Ab Cd Ef
D. None of the mentioned
Answer» D. None of the mentioned
721.

What is the output of the following? print('Ab!2'.swapcase())

A. AB!@
B. ab12
C. aB!2
D. aB1@
Answer» D. aB1@
722.

What is the output of the following? print('ab\ncd\nef'.splitlines())

A. [‘ab’, ‘cd’, ‘ef’].
B. [‘ab’, ‘cd’, ‘ef’].
C. [‘ab’, ‘cd’, ‘ef’].
D. [‘ab’, ‘cd’, ‘ef’].
Answer» B. [‘ab’, ‘cd’, ‘ef’].
723.

What is the output of the following? print('abcdefcdghcd'.split('cd', 2))

A. [‘ab’, ‘ef’, ‘ghcd’].
B. [‘ab’, ‘efcdghcd’].
C. [‘abcdef’, ‘ghcd’].
D. none of the mentioned
Answer» B. [‘ab’, ‘efcdghcd’].
724.

What is the output of the following? print('abcdefcdghcd'.split('cd', -1))

A. [‘ab’, ‘ef’, ‘gh’].
B. [‘ab’, ‘ef’, ‘gh’, ”].
C. (‘ab’, ‘ef’, ‘gh’)
D. (‘ab’, ‘ef’, ‘gh’, ”)
Answer» C. (‘ab’, ‘ef’, ‘gh’)
725.

What is the output of the following? print('abcdefcdghcd'.split('cd', 0))

A. [‘abcdefcdghcd’].
B. ‘abcdefcdghcd’
C. error
D. none of the mentioned
Answer» B. ‘abcdefcdghcd’
726.

What is the output of the following? print('abcdefcdghcd'.split('cd'))

A. [‘ab’, ‘ef’, ‘gh’].
B. [‘ab’, ‘ef’, ‘gh’, ”].
C. (‘ab’, ‘ef’, ‘gh’)
D. (‘ab’, ‘ef’, ‘gh’, ”)
Answer» C. (‘ab’, ‘ef’, ‘gh’)
727.

What is the output of the following? print('xyyxyyxyxyxxy'.replace('xy', '12', 100))

A. xyyxyyxyxyxxy
B. 12y12y1212x12
C. none of the mentioned
D. error
Answer» C. none of the mentioned
728.

What is the output of the following? print('xyyxyyxyxyxxy'.replace('xy', '12', 0))

A. xyyxyyxyxyxxy
B. 12y12y1212x12
C. 12yxyyxyxyxxy
D. xyyxyyxyxyx12
Answer» B. 12y12y1212x12
729.

What is the output of the following? print('abcefd'.replace('cd', '12'))

A. ab1ef2
B. abcefd
C. ab1efd
D. ab12ed2
Answer» C. ab1efd
730.

What is the output of the following? print('abef'.replace('cd', '12'))

A. abef
B. 12
C. error
D. none of the mentioned
Answer» B. 12
731.

What is the output of the following? print('abcdef12'.replace('cd', '12'))

A. ab12ef12
B. abcdef12
C. ab12efcd
D. none of the mentioned
Answer» B. abcdef12
732.

What is the output of the following? print('abef'.partition('cd'))

A. (‘abef’)
B. (‘abef’, ‘cd’, ”)
C. (‘abef’, ”, ”)
D. error
Answer» D. error
733.

What is the output of the following? print('cd'.partition('cd'))

A. (‘cd’)
B. (”)
C. (‘cd’, ”, ”)
D. (”, ‘cd’, ”)
Answer» E.
734.

What is the output of the following? print('abcd'.partition('cd'))

A. (‘ab’, ‘cd’, ”)
B. (‘ab’, ‘cd’)
C. error
D. none of the mentioned
Answer» B. (‘ab’, ‘cd’)
735.

What is the output of the following? print('abcdefcdgh'.partition('cd'))

A. (‘ab’, ‘cd’, ‘ef’, ‘cd’, ‘gh’)
B. (‘ab’, ‘cd’, ‘efcdgh’)
C. (‘abcdef’, ‘cd’, ‘gh’)
D. error
Answer» C. (‘abcdef’, ‘cd’, ‘gh’)
736.

What is the output of the following? print('abcdef'.partition('cd'))

A. (‘ab’, ‘ef’)
B. (‘abef’)
C. (‘ab’, ‘cd’, ‘ef’)
D. 2
Answer» D. 2
737.

What is the output of the following? print('a'.maketrans('ABC', '123'))

A. {97: 49, 98: 50, 99: 51}
B. {65: 49, 66: 50, 67: 51}
C. {97: 49}
D. 1
Answer» B. {65: 49, 66: 50, 67: 51}
738.

What is the output of the following? print('cba'.maketrans('abc', '123'))

A. {97: 49, 98: 50, 99: 51}
B. {65: 49, 66: 50, 67: 51}
C. 321
D. 123
Answer» B. {65: 49, 66: 50, 67: 51}
739.

What is the output of the following? print('xyxxyyzxxy'.lstrip('xyy'))

A. zxxy
B. xyxxyyzxxy
C. xyxzxxy
D. none of the mentioned
Answer» B. xyxxyyzxxy
740.

What is the output of the following? print('xyyzxxyxyy'.lstrip('xyy'))

A. error
B. zxxyxyy
C. z
D. zxxy
Answer» C. z
741.

What is the output of the following? print(''' \tfoo'''.lstrip())

A. foo
B. foo
C. foo
D. none of the mentioned
Answer» C. foo
742.

What is the output of the following? print('1Rn@'.lower())

A. n
B. 1rn@
C. rn
D. r
Answer» C. rn
743.

What is the output of the following? print('Hello!2@#World'.istitle())

A. True
B. False
C. None
D. error
Answer» B. False
744.

What is the output of the following? print('Hello World'.istitle())

A. True
B. False
C. None
D. Error
Answer» B. False
745.

What is the output of the following? print('HelloWorld'.istitle())

A. True
B. False
C. None
D. Error
Answer» C. None
746.

What is the output of the following? print('\t'.isspace())

A. True
B. False
C. None
D. Error
Answer» B. False
747.

What is the output of the following? print(''''''.isspace())

A. True
B. False
C. None
D. Error
Answer» C. None
748.

What is the output of the following? print('1@ a'.isprintable())

A. True
B. False
C. None
D. Error
Answer» B. False
749.

What is the output of the following? print('1.1'.isnumeric())

A. True
B. False
C. None
D. Error
Answer» C. None
750.

What is the output of the following? print('11'.isnumeric())

A. True
B. False
C. None
D. Error
Answer» B. False