0% found this document useful (0 votes)
30 views

Python-Mid1-IMP ObjectiveQuestions

The document contains 20 multiple choice questions about Python programming concepts such as data types, operators, functions, files and more. Key topics covered include Python's support of object oriented, structured and functional programming; evaluating arithmetic expressions; using comments and the len() function; file handling methods like readline(); and built-in functions like len(), type(), print(), pop() and os.mkdir().
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Python-Mid1-IMP ObjectiveQuestions

The document contains 20 multiple choice questions about Python programming concepts such as data types, operators, functions, files and more. Key topics covered include Python's support of object oriented, structured and functional programming; evaluating arithmetic expressions; using comments and the len() function; file handling methods like readline(); and built-in functions like len(), type(), print(), pop() and os.mkdir().
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Which type of Programming does Python support?.

[D ]
A) Object Oriented B) Structured Programming C) Functional Programming D) all the above

2. What will be the value of the following Python expression? 4 + 3 % 5 [a ]


A) 7 B) 4 C) 2 D) 1

3. Which of the following character is used to give single-line comments in Python? [C ]


A) // B) /* */ C) # D) !

4. Which of the following is the use of id() function in python? [B ]


A) Every object doesn’t have a unique id B) identity of the object C) object value D) None

5. What will be the output of the following function? len([5, 7, 3,”hello”, True])
[C ]
A) 2 B) 4 C) 5 D) 3

6. What arithmetic operators cannot be used with strings in Python? [C ]


A) + B) * C) - D) all

7. Which of the following Python statements will result in the output: 6? A=[[1,2,3],[4,5,6][7,8,9] [B ]
A) A[2][2] B) A[1][2]
C) A[2][1] D) A[1][1]

8. Which of the following statements are true?d ]


A) When you open a file for reading, if the file does not exist, an error occurs
B) When you open a file for writing, if the file does not exist, a new file is created
C) When you open a file for writing, if the file exists, the existing file is overwritten with the new file
D) All of the above

9. To read the next line of the file from a file object fp, we use [B ]
A) fp.read() B) fp.readline() C) fp.read(10) D) fp.readlines()

10. Which one of the following is the use of function in python? [D ]


A) Functions don’t provide better modularity B) Functions are reusable pieces of programs
C) To improve readability D) B&C
11. Which function is used to read all the characters from a file _____r_________.

12. What will be the output of the code : len({1,1,1,2,2,4,5,6,3,4}) ___6_______.

13. Tuples can’t made as keys in dictionary (True/ False) ____false_________.

14. Which method is used to get the dictionary keys python dictionaykeys

15. What will be the output of the python code? Print(r”\nHello ‘student’”) __/n hello 'stidents'_________

16. S=[1,2,3,4,5,6] ; print(S[::-1]) Output: [_654321]_________________

17. print(type(type(int)) output : classes type

18. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1) __3,5,20,5,2,1,3____________

19. Which function is used to create a directory in python di.dit .

20. ________________ Module is used to access file system in python.

You might also like