top of page
Search
For Loop MCQ in Python
Q1. What is the output of the following Python code? x={1:"X",2:"Y",3:"Z"} for i,j in x.items(): print(i,j,end=" ") A. 1 X 2 Y 3 Z B. 1 2 3 C. X Y Z D. 1:”X” 2:”Y” 3:”Z” Ans: A Q2. What is output of the following Python code? x = ['ab', 'cd'] for i in x: i.upper() print(x) A. [‘ab’, ‘cd’] B. [‘AB’, ‘CD’] C. [None, None] D. None of Above Ans: A (list' object has no attribute 'upper') Q3. What is the output of the following code? y= ['ab', 'cd'] f
Rajesh Singh
Dec 15, 20246 min read
Files MCQ in Python
File Processing MCQ Q1. Which function writes a list of lines in File? A. Writelines() B. Write() C. Tell() D. All of...
Rajesh Singh
Dec 2, 20246 min read
Python List MCQ Questions
Q1. What is output of below python code? dict= {1:'1', 2:'2', 3:'3'} del dict[1] dict[1] = '10' del dict[2] print (len(dict)) A. 1 B. 2 C. 3 D. 0 Ans: B Q2. Which are methods of list? A. append() B. extend() C. insert() D. All of the above Ans: D: Q3. The list.pop ([i]) is used for removing the item at the given position in the list? A. Yes B. No Ans: A: Q4. list, tuple dictionary are which types of Data Types. A. Binary Types B. Boolean Types C. Sequence Types D. None
Rajesh Singh
Dec 1, 20245 min read


Python NUMPY MCQ Questions
Python NumPy Chapter MCQ: 1. What will be print? Import numpy as np a = np. array([1,2,3,5,8]) b = np. array([0,3,4,2,1]) c = a+b c = c*a print(c[2]) A. 7 B. 12 C. 10 D. 21 Answer: D 2. What will be output for the following code? Import numpy as np ary = np. array([1,2,3,5,8]) ary = ary+1 print(ary[1]) A. 0 B. 1 C. 2 D. 3 Answer: D 3. import numpy as np. a = np.array([[1,2,3],[0,1,4]]) print(a.size) A. 1 B. 5 C. 6 D. 4 Answer: C 4. import numpy as np a = np.array([1,2,3,5,8
Rajesh Singh
Dec 1, 20247 min read
bottom of page
