This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 40 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 40 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which keyword is used to define a function in Python? A) Method. B) Function. C) Def. D) Define. Show Answer Correct Answer: C) Def. 2. Which data type is used to store:100 A) Integer. B) Double. C) Boolean. D) String. Show Answer Correct Answer: A) Integer. 3. How do you start a comment in Python? A) //. B) #. C) . D) /*. Show Answer Correct Answer: B) #. 4. What is the code for a STRING in python? A) Str. B) Stri. C) Stg. D) None of the above. Show Answer Correct Answer: A) Str. 5. Which of the following is used to check multiple conditions in Python? A) If else. B) If elif else. C) For. D) Def. Show Answer Correct Answer: B) If elif else. 6. What symbol is used in python to assign values to a variable? A) Equals =. B) Plus +. C) Forward slash /. D) Asterisk *. Show Answer Correct Answer: A) Equals =. 7. What will the following code output:for i in range(3):print(i)? A) 1, 2, 3. B) 0, 1, 2. C) 012. D) -1, 0, 1. Show Answer Correct Answer: C) 012. 8. Is the input command predefined in Python? A) Not sure. B) No. C) Yes. D) Its not predefined. Show Answer Correct Answer: C) Yes. 9. Which loop repeats a block of code while a condition is true? A) For. B) While. C) Repeat. D) Loop. Show Answer Correct Answer: B) While. 10. What will the following code output? print(5 == 5) A) True. B) False. C) None. D) Error. Show Answer Correct Answer: A) True. 11. Which Python command is used to output information to the screen? A) Read. B) Output. C) Print. D) Display. Show Answer Correct Answer: C) Print. 12. What is the default path where Python looks for modules? A) The directory where the script is located. B) The system's library directory. C) The Python installation directory. D) The current working directory. Show Answer Correct Answer: A) The directory where the script is located. 13. Which of the following statements is true about local and global variables in Python functions? A) Local variables can be accessed outside the function where they are defined. B) Global variables can be accessed only inside the function where they are defined. C) Local variables exist only within the function and cannot be accessed outside it. D) Global variables cannot be accessed by functions. Show Answer Correct Answer: C) Local variables exist only within the function and cannot be accessed outside it. 14. What types of data does Python support? A) Int, float, Boolean, string, and list. B) Only integers and strings. C) Only lists and dictionaries. D) None of the above. Show Answer Correct Answer: A) Int, float, Boolean, string, and list. 15. Which algorithm would be the most efficient algorithm for finding a name in a phone book? A) Flipping through the book two pages at a time. B) Starting from the first page and looking for a name one page at a time. C) Opening the phone book to the middle and dividing the problem in half each time. D) Opening the phone book to a random page and searching from there. Show Answer Correct Answer: C) Opening the phone book to the middle and dividing the problem in half each time. 16. Why did Python's creator name the language after Monty Python's Flying Circus? A) Due to its association with large snakes. B) Because it's a widely-used language. C) In honor of the TV show. D) As a tribute to Hollywood Bowl. Show Answer Correct Answer: C) In honor of the TV show. 17. What does the subprogram 'chr' do in PLS? A) Displays the content of prompt to the screen. B) Returns the length of the object. C) Returns the string which matches the Unicode value of. D) Rounds a number to a specified number of digits. Show Answer Correct Answer: C) Returns the string which matches the Unicode value of. 18. What is the main characteristic of PyPy? A) It is a Python version written in Java. B) It translates Python code into C code for execution. C) It is an implementation optimized for microcontrollers. D) It is a Python version written in RPython. Show Answer Correct Answer: B) It translates Python code into C code for execution. 19. Write the output of the following code:x = 4-7j; print(x.imag, x.real) A) 4.0-7.0. B) -7.0 4.0. C) Error. D) None of the above. Show Answer Correct Answer: B) -7.0 4.0. 20. What will this display?age = 10print(age + 5) A) Age + 5. B) 15. C) 105. D) Error. Show Answer Correct Answer: B) 15. 21. What is the primary purpose of a programming language? A) To design computer hardware. B) To write and execute human languages. C) To give instructions to a computer. D) To browse the internet. Show Answer Correct Answer: C) To give instructions to a computer. 22. How do you insert COMMENTS in Python code? A) /*this is a comment. B) //this is a comment. C) #this is a comment. D) None of the above. Show Answer Correct Answer: C) #this is a comment. 23. What Python command lets the user enter an answer to a question? A) Answer(). B) Open(). C) Print(). D) Input(). Show Answer Correct Answer: D) Input(). 24. Python is an example of: A) Procedural Programming Language. B) Assembly Language. C) Machine Language. D) High-Level Programming Language. Show Answer Correct Answer: D) High-Level Programming Language. 25. What are the three important data structures in Pandas? A) Series, DataFrame, and Panel. B) Array, List, and Dictionary. C) Matrix, DataFrame, and Series. D) Table, Chart, and Graph. Show Answer Correct Answer: A) Series, DataFrame, and Panel. ← PreviousNext →Related QuizzesClass 11 Computer Science Chapter 2 Introduction To Python Quiz 1Class 11 Computer Science Chapter 2 Introduction To Python Quiz 2Class 11 Computer Science Chapter 2 Introduction To Python Quiz 3Class 11 Computer Science Chapter 2 Introduction To Python Quiz 4Class 11 Computer Science Chapter 2 Introduction To Python Quiz 5Class 11 Computer Science Chapter 2 Introduction To Python Quiz 6Class 11 Computer Science Chapter 2 Introduction To Python Quiz 7Class 11 Computer Science Chapter 2 Introduction To Python Quiz 8Class 11 Computer Science Chapter 2 Introduction To Python Quiz 9Class 11 Computer Science Chapter 2 Introduction To Python Quiz 10 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books