This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 9 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 9 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the result of the 'not' operator in programming? A) It checks if both sides of the test are true. B) It checks if either side of the test is true. C) It inverts the result of the test. D) It divides one value by another. Show Answer Correct Answer: C) It inverts the result of the test. 2. In python do you have to declare the variable first? A) Nothing. B) Maybe. C) Yes. D) Do not have to declare the variable. Show Answer Correct Answer: D) Do not have to declare the variable. 3. Output of print(2 * 3 ** 2) is A) 16. B) 64. C) 18. D) Error. Show Answer Correct Answer: C) 18. 4. Which of the following is a sequence data type? A) Integer. B) Dictionary. C) String. D) Float. Show Answer Correct Answer: C) String. 5. Which data type is used to store:"D" A) Double. B) Character. C) String. D) Integer. Show Answer Correct Answer: B) Character. 6. What are binary digits called? A) Transistors. B) Bytes. C) Bits. D) Switches. Show Answer Correct Answer: C) Bits. 7. What is the significance of the 'index' parameter in the read ..... csv() function? A) It sets the delimiter used in the CSV file. B) It determines the number of rows to read from the file. C) It specifies whether to use the first row as the header. D) It indicates the data type of the columns. Show Answer Correct Answer: C) It specifies whether to use the first row as the header. 8. What is the result of the following code? "'pythoncount = 0while count < 3:print(count) count += 1 "' A) '1 2 3'. B) '0 1 2'. C) '0 1 2 3'. D) '0 1 2 3 4'. Show Answer Correct Answer: B) '0 1 2'. 9. How are elements accessed in a list? A) Using functions. B) Using values. C) Using keys. D) Using index. Show Answer Correct Answer: D) Using index. 10. Given the code score = 7 and print("Your score is '' + score), which option fixes the code without using concatenation, but still prints neatly? A) Print(score + "Your score is"). B) Print("Your score is" + score). C) Print("Your score is", score). D) Print("score", "Your score is"). Show Answer Correct Answer: C) Print("Your score is", score). 11. What does a variable do? A) Repeats actions. B) Holds information. C) Makes decisions. D) Draws pictures. Show Answer Correct Answer: B) Holds information. 12. Sophia is learning Python and wants to know which of the following is a loop structure in Python? A) For loop and while loop. B) Repeat until loop. C) Do while loop. D) Foreach loop. Show Answer Correct Answer: A) For loop and while loop. 13. A ..... is a collection of Python modules. A) List. B) Super module. C) Library. D) None of the mentioned. Show Answer Correct Answer: C) Library. 14. Which of the following is used to get input from the user in Python? A) Read(). B) Print(). C) Input(). D) Scan(). Show Answer Correct Answer: C) Input(). 15. Generally speaking Python (TM) would run ..... than C++ and take ..... time to create A) Slower, less. B) Slower, more. C) Faster, less. D) Faster, more. Show Answer Correct Answer: A) Slower, less. 16. What is the primary focus of Python's design philosophy? A) Strict type enforcement. B) Complexity and obfuscation. C) Code readability and simplicity. D) Performance optimization. Show Answer Correct Answer: C) Code readability and simplicity. 17. Your program asks users to enter their age in years. What data type will Python return for that input if someone enters a value of 13.50? A) Integer. B) String. C) Null. D) Float. Show Answer Correct Answer: B) String. 18. Which of the following is NOT a valid data type in Python? A) Str. B) Int. C) Float. D) Real. Show Answer Correct Answer: D) Real. 19. How do you join two strings 'first' and 'last' with a space between them? A) First + last. B) First.concat(last). C) First + '' '' + last. D) First & last. Show Answer Correct Answer: C) First + '' '' + last. 20. What is the result of the following code? "'pythonweight = 8print(type(weight)) "' A) . B) . C) . D) . Show Answer Correct Answer: A) . 21. What is the purpose of the Matplotlib library? A) Used for data analysis and manipulation. B) Used for plotting graphs and visualisation. C) Used for web development and design. D) Used for machine learning and AI. Show Answer Correct Answer: B) Used for plotting graphs and visualisation. 22. Strings in Python are written inside: A) []. B) '' or "". C) {}. D) <>. Show Answer Correct Answer: B) '' or "". 23. What is the purpose of introducing extra spaces within a line of Python code? A) To make the code run faster. B) To make the code more easily understood when it involves nested subprogram calls. C) To change the syntax of Python. D) To create a syntax error. Show Answer Correct Answer: B) To make the code more easily understood when it involves nested subprogram calls. 24. Which random function returns a random 'float' number between 0 and 1? A) Random.random(). B) Random.floating(). C) Rand.floating(). D) None of the mentioned. Show Answer Correct Answer: A) Random.random(). 25. What type of value does the input() function return? A) Int. B) Float. C) Str. D) Bool. Show Answer Correct Answer: C) Str. 26. Which of the following is a string? A) 123. B) True. C) 'hello'. D) None. Show Answer Correct Answer: C) 'hello'. 27. What is the output of the following code? "'pythonprint("Hello, World!") "' A) 'HELLO, WORLD!'. B) 'Hello World'. C) 'hello, world!'. D) 'Hello, World!'. Show Answer Correct Answer: D) 'Hello, World!'. 28. Each statement in Python is terminated by ..... A) Comma(, ). B) Colon(:). C) Semicolon(;). D) None of the above. Show Answer Correct Answer: D) None of the above. 29. A software update often helps with the removal of ..... A) Harddisk. B) Bugs. C) All the above. D) None of the above. Show Answer Correct Answer: B) Bugs. 30. What is the correct syntax to print 'Hello, World!' in Python? A) Print('Hello World!'). B) Print('Hello, World!'). C) Println('Hello, World!'). D) Echo 'Hello, World!'. Show Answer Correct Answer: B) Print('Hello, World!'). 31. Read the Python program below:1 print("Where do you live?")2 location = input()3 print("I've never been to", location)When this program is executed, what will be displayed on the screen, as a result of executing line 3? A) I've never been to and whatever the user has typed at the keyboard. B) I've never been to location. C) I've never been to input(). D) It is not possible to know the output without executing the program. Show Answer Correct Answer: A) I've never been to and whatever the user has typed at the keyboard. 32. Which keyword is used to stop a loop? A) Break. B) Exit. C) End. D) Stop. Show Answer Correct Answer: A) Break. 33. WHO INVENTED PYTHON? A) CHARLES BABBAGE. B) RAY TOMLONSON. C) Guido van Rossum. D) None of the above. Show Answer Correct Answer: C) Guido van Rossum. 34. Which operator is used for logical AND in Python? A) &&. B) ||. C) And. D) &&&. Show Answer Correct Answer: C) And. 35. Which one of the following is the most appropriate python language feature? A) Syntax Free. B) Open source. C) High Level Language. D) Usable with only one device. Show Answer Correct Answer: C) High Level Language. 36. What is IDLE in the context of Python? A) IDLE is a command-line tool for Python scripting. B) IDLE is a Python framework for web development. C) IDLE is a type of Python library. D) IDLE is the Integrated Development and Learning Environment for Python. Show Answer Correct Answer: D) IDLE is the Integrated Development and Learning Environment for Python. 37. What is the result type of comparisons like y==z in Python? A) Int. B) List. C) Bool. D) Str. Show Answer Correct Answer: C) Bool. 38. What is the result of this expression:3 + 2 * 4? A) 16. B) 14. C) 20. D) 11. Show Answer Correct Answer: D) 11. 39. What does the ' = open(, "a")' command do in Python? A) Opens a file for reading. B) Opens a file for writing. C) Closes a file. D) Opens a file for appending. Show Answer Correct Answer: D) Opens a file for appending. 40. Python identifies blocks of code by A) BEGIN and END keywords. B) { and }. C) Aligning up the starts of lines (indentation). D) Guessing. Show Answer Correct Answer: C) Aligning up the starts of lines (indentation). 41. How does the Python community contribute to its popularity? A) By providing online resources, forums, and tutorials. B) By keeping the language closed-source. C) By limiting the development of new libraries. D) By discouraging collaboration. Show Answer Correct Answer: A) By providing online resources, forums, and tutorials. 42. The list needs one more name added to the end- "Felipe" . Which piece of code below would do this?nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"] A) NameList.append["Felipe", 7]. B) NameList.append("Felipe"). C) NameList.append(Felipe). D) Append(nameList, "Felipe"). Show Answer Correct Answer: B) NameList.append("Felipe"). 43. Which symbol means "equal to" in an 'if' condition? A) <=. B) =. C) ==. D) !=. Show Answer Correct Answer: C) ==. 44. What is the result of the following expression in Python:'3 + 4.5'? A) 7.0. B) 8. C) 7. D) 7.5. Show Answer Correct Answer: D) 7.5. 45. What is the output of the following code? "'pythona = 10b = 5print(a // b) "' A) 0. B) 2.0. C) 2. D) 5. Show Answer Correct Answer: C) 2. 46. How do you delete data in SQL? A) ERASE. B) DELETE. C) REMOVE. D) DROP. Show Answer Correct Answer: B) DELETE. 47. Which is the correct syntax for a while loop that increments x until it reaches 5? A) While (x < 5) { x += 1 }. B) While x < 5:x += 1. C) While (x < 5):{ x += 1 }. D) While x < 5 do:x += 1. Show Answer Correct Answer: B) While x < 5:x += 1. 48. Which of the following is used to create a tuple in Python? A) []. B) (). C) {}. D) <>. Show Answer Correct Answer: B) (). 49. What is the purpose of algorithms? A) To translate programming languages. B) To display messages. C) To solve a problem. D) To execute instructions. Show Answer Correct Answer: C) To solve a problem. 50. X = 50def func(x):print('x is', x)x = 2print('Changed local x to', x)func(x)print('x is now', x) A) X is 50 Changed local x to 2 x is now 50. B) X is 50 Changed local x to 2 x is now 2. C) X is 50 Changed local x to 2 x is now 100. D) None. Show Answer Correct Answer: A) X is 50 Changed local x to 2 x is now 50. 51. What happens if you leave out one of the double quotes in a string? A) The program displays a warning. B) The program ignores the missing quote. C) The program runs normally. D) The program gives an error message. Show Answer Correct Answer: D) The program gives an error message. 52. How do you create a negative of a picture in Python? A) By using the getPixels function. B) By changing the brightness of the picture. C) By reversing the color values of each pixel. D) By applying a filter to the picture. Show Answer Correct Answer: C) By reversing the color values of each pixel. 53. What is the output of print(type("5"))? A) Int. B) Float. C) Str. D) None. Show Answer Correct Answer: C) Str. 54. What does BIDMAS stand for? A) Brackets, Indices, Division, Multiplication, Addition, Subtraction. B) Brackets, Indices, Division, Multiplication, Addition, Subtraction. C) Brackets, Indices, Division, Multiplication, Addition, Subtraction. D) Brackets, Indices, Division, Multiplication, Addition, Subtraction. Show Answer Correct Answer: A) Brackets, Indices, Division, Multiplication, Addition, Subtraction. 55. Give an example of python output? A) Print(" "). B) Print**. C) Print. D) Print(". Show Answer Correct Answer: A) Print(" "). 56. What will happen if you do not indent code properly in Python? A) It will display a warning. B) The code will run successfully. C) It will run but give incorrect results. D) It will cause a syntax error. Show Answer Correct Answer: D) It will cause a syntax error. 57. In a for loop using enumerate on a tuple, which unpacking is correct to access index and value? A) For v, i in enumerate(t):. B) For i in t:enumerate(i). C) For index in enumerate(t):. D) For i, v in enumerate(t):. Show Answer Correct Answer: D) For i, v in enumerate(t):. 58. A ..... is a single Python file which contains Python objects such as variables, functions and classes and may also contain executable code, not just definitions. A) Directory. B) Module. C) Collection. D) None of the mentioned. Show Answer Correct Answer: B) Module. 59. Which of the following is the correct format for a for-loop in Python? A) For x in range(5):. B) For x to 5:. C) For x <= 5:. D) For x in 5:. Show Answer Correct Answer: A) For x in range(5):. 60. What does 'int' mean in Python? A) Internal. B) Into. C) Interesting. D) Integer. Show Answer Correct Answer: D) Integer. ← PreviousNext →Related QuizzesScience QuizzesClass 11 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 8 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books