This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 37 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 37 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the output of the following code? "'pythonounces = 16print("There are", ounces, "ounces in a pint.") "' A) There are 16 ounces in a pint. B) There are ounces 16 in a pint. C) There are "16" ounces in a pint. D) There are 16 in a pint ounces. Show Answer Correct Answer: A) There are 16 ounces in a pint. 2. Which of the following is a valid way to assign multiple values to variables in Python? A) X, y = 1, 2. B) X, y = [1, 2]. C) X = 1, y = 2. D) X = (1, 2). Show Answer Correct Answer: A) X, y = 1, 2. 3. Which data type is used to store text? A) Int. B) Str. C) Float. D) Bool. Show Answer Correct Answer: B) Str. 4. What will the following code output? print('Hello' + str(5)) A) Hello5. B) Hello 5. C) 5Hello. D) Error. Show Answer Correct Answer: A) Hello5. 5. Which of the following is used to store a sequence of items in Python? A) Integer. B) String. C) List. D) Float. Show Answer Correct Answer: C) List. 6. What does turn(90) do? A) Turns right 90 degrees. B) Turns left 90 degrees. C) Moves forward 90. D) Does nothing as 'turn' is not a turtle instruction. Show Answer Correct Answer: D) Does nothing as 'turn' is not a turtle instruction. 7. What command is used to run a Python script in IDLE? A) Alt + S. B) Shift + Enter. C) F5. D) Ctrl + R. Show Answer Correct Answer: C) F5. 8. The boolean expression True or Falseevaluates to: A) False. B) True. C) Or. D) "". Show Answer Correct Answer: B) True. 9. What is the output of the following code? "'pythonprint(7 + 3) "' A) 10. B) 73. C) 7 + 3. D) 1.0. Show Answer Correct Answer: A) 10. 10. Which of the following represents "equal to" in Python? A) !=. B) ==. C) =/=. D) <>. Show Answer Correct Answer: B) ==. 11. What does the 'values' attribute of a DataFrame return? A) A NumPy array containing all the values in the DataFrame. B) A list of column names in the DataFrame. C) A dictionary representation of the DataFrame. D) A Pandas Series of the first column in the DataFrame. Show Answer Correct Answer: A) A NumPy array containing all the values in the DataFrame. 12. Which of these is NOT a core component of a computer? A) CPU (Processor. B) Memory (RAM). C) A Computer Program. D) Storage (Hard Drive/SSD). Show Answer Correct Answer: C) A Computer Program. 13. What is the correct way to exit a while loop prematurely in Python? A) 'exit'. B) 'stop'. C) 'break'. D) 'terminate'. Show Answer Correct Answer: C) 'break'. 14. Choose the correct syntax for lambda function. A) Lambda x, y:return x + y. B) Def lambda x, y:x + y. C) Lambda x, y:x + y. D) Lambda x, y = x + y. Show Answer Correct Answer: C) Lambda x, y:x + y. 15. How can you make an exception more reusable in Python? A) By using the 'raise' keyword. B) By adding parameters to a function. C) By using the 'pass' keyword. D) By defining multiple exceptions. Show Answer Correct Answer: B) By adding parameters to a function. 16. How do you create your own module in Python? A) By using the module keyword. B) By using the def keyword inside a file. C) By defining functions in a .py file. D) By importing built-in modules. Show Answer Correct Answer: C) By defining functions in a .py file. 17. How do you take input in python? A) Cin>>a;. B) A = input(). C) Scanf(%d, &a);. D) A = sc.NextInt();. Show Answer Correct Answer: B) A = input(). 18. What extension must you add to the end of a file when saving? A) .c. B) .java. C) .py. D) .pyc. Show Answer Correct Answer: C) .py. 19. Code forFive is greater than two! A) If 5 > 2:print("Five is greater than two!"). B) If 5 = 2:print("Five is greater than two!"). C) If 5 > 2:Print("Five is greater than two!"). D) None of the above. Show Answer Correct Answer: A) If 5 > 2:print("Five is greater than two!"). 20. The items listed in the parenthesis of a procedure definition are called ..... A) Comments. B) Scripts. C) Parameters. D) Variables. Show Answer Correct Answer: C) Parameters. 21. A programmer types flt(price), what type of data are they assigning to the price? A) Boolean. B) Float. C) String. D) Integer. Show Answer Correct Answer: B) Float. 22. What is the result of the expression '5 + 3 * 2' in Python? A) 16. B) 11. C) 13. D) 10. Show Answer Correct Answer: B) 11. 23. Which operator is used for division? A) /. B) //. C) %. D) -. Show Answer Correct Answer: A) /. 24. Bagaimana cara menyisipkan komentar dalam kode Python? A) Gunakan '#' untuk komentar satu baris dan triple quotes untuk komentar multi-baris. B) Gunakan '//' untuk komentar satu baris dan '/* */' untuk komentar multi-baris. C) Gunakan '/*' untuk komentar satu baris dan '#' untuk komentar multi-baris. D) Gunakan '//' untuk komentar dalam Python dan '"""' untuk komentar multi-baris. Show Answer Correct Answer: A) Gunakan '#' untuk komentar satu baris dan triple quotes untuk komentar multi-baris. 25. Which of the following is NOT a sequence type in Python? A) Dictionary. B) List. C) Tuple. D) String. Show Answer Correct Answer: A) Dictionary. ← 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