This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 7 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 7 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. A = 5a = 83print(a)When this program is executed, what will be displayed on the screen? A) 83. B) There is an error in the program because variable a cannot hold two values at the same time. C) 5 83. D) 5. E) 88. Show Answer Correct Answer: A) 83. 2. Which of the following variable names is NOT valid in Python? A) UserAge. B) 2ndPlace. C) Total weight. D) First name. Show Answer Correct Answer: B) 2ndPlace. 3. Which operator is used for 'not equal'? A) =. B) ><. C) !=. D) ==. Show Answer Correct Answer: C) !=. 4. What will be the output of the following code? "'pythonlength = 5width = 2print(length * width, "metres") "' A) 7 metres. B) 5 metres. C) 10 metres. D) 2 metres. Show Answer Correct Answer: C) 10 metres. 5. What data type is used for text in Python? A) Str. B) Int. C) Float. D) List. Show Answer Correct Answer: A) Str. 6. What is the output of the following code:print('Hello, World!')? A) Hello, World!. B) Error. C) 'Hello, World!'. D) Hello World!. Show Answer Correct Answer: A) Hello, World!. 7. Which of the following statements will print the value of variable 'weight' in pounds? A) Print(pounds, weight). B) Print("pounds", weight). C) Print("weight pounds"). D) Print(weight, "pounds"). Show Answer Correct Answer: D) Print(weight, "pounds"). 8. Which of the following is NOT a valid Python variable name? A) '2nd place'. B) 'studentName'. C) 'student name'. D) 'place2'. Show Answer Correct Answer: A) '2nd place'. 9. Is the type of errors that happens when the computer is not able to make the conversion reliably A) Logical error. B) Semantic errors. C) Syntax error. D) Compilation error. E) Run-time error. Show Answer Correct Answer: D) Compilation error. 10. What are the main features of Python? A) Main features of Python include simplicity and readability, support for multiple programming paradigms, a large standard library, dynamic typing, and being an interpreted language. B) Requires complex syntax for basic tasks. C) Has a small standard library. D) Supports only procedural programming. Show Answer Correct Answer: A) Main features of Python include simplicity and readability, support for multiple programming paradigms, a large standard library, dynamic typing, and being an interpreted language. 11. What will the following recursive function return?def sum ..... range(n):if n <= 0:return 0return n + sum ..... range(n-1)print(sum ..... range(5)) A) 20. B) 5. C) 15. D) 10. Show Answer Correct Answer: C) 15. 12. What is the purpose of a syntax error in Python? A) To execute a specific task in the program. B) To enhance the performance of the program. C) To indicate an error in the program's structure. D) To add more information to the code. Show Answer Correct Answer: C) To indicate an error in the program's structure. 13. All computer programs must be written in the python shell. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 14. Python supports dynamic typing. A) True. B) Not applicable. C) Depends on the version. D) False. Show Answer Correct Answer: A) True. 15. What data type is a in this code:a = "5" A) String. B) Integer. C) Boolean. D) Float. Show Answer Correct Answer: A) String. 16. What operator would I need to add 5 and 10? A) +. B) /. C) -. D) *. Show Answer Correct Answer: A) +. 17. ..... are reserved words. A) Comments. B) Variables. C) Identifiers. D) Keywords. Show Answer Correct Answer: D) Keywords. 18. To repeat until a particular condition is true use: A) For loop. B) While loop. C) If loop. D) Indentation. Show Answer Correct Answer: B) While loop. 19. What will the following code output? 'print("5 + 3 =", 5 + 3)' A) 5 + 3 = 53. B) Error. C) 5 + 3 = 5 + 3. D) 5 + 3 = 8. Show Answer Correct Answer: D) 5 + 3 = 8. 20. Which of the following is the correct syntax for a while loop in Python? A) 'while (condition) { }'. B) 'while (condition):'. C) 'while condition:'. D) 'while condition { }'. Show Answer Correct Answer: C) 'while condition:'. 21. The Raspberry Pi devices used in this course use which operating system (O/S)? A) Chrome. B) Windows 10. C) Apple iOS. D) Debian Linux. Show Answer Correct Answer: D) Debian Linux. 22. What will happen if you run this code print('red is my favourite colour") (a) A) A. SyntaxError. B) Get the result ''red is my favourite colour". C) All the above. D) None of the above. Show Answer Correct Answer: A) A. SyntaxError. 23. What is the result of the expression 'Hello' + ' World'? A) Hello, World!. B) Hello World. C) HelloWorld. D) Hello World!. Show Answer Correct Answer: C) HelloWorld. 24. Which statement correctly assigns the string "Tanner" to the variable name? A) Name = input("Tanner"). B) Name = print( "Tanner"). C) Input("Tanner"). D) Name = "Tanner". Show Answer Correct Answer: D) Name = "Tanner". 25. Which of the following is a valid integer in Python? A) 42. B) 'hello'. C) -1.5. D) 3.14. Show Answer Correct Answer: A) 42. 26. What is one reason for Python's huge community support? A) It is the only programming language used in data science. B) Python has no learning curve, making it hard for beginners. C) Its complexity makes it suitable for advanced programmers. D) Its simplicity and readability make it accessible to beginners. Show Answer Correct Answer: D) Its simplicity and readability make it accessible to beginners. 27. Which of the following is a key design feature of Python that enforces code structure? A) Use of semicolons (;) at the end of every line. B) Mandatory use of curly braces ({}) to define code blocks. C) Significant use of indentation (whitespace) to define code blocks. D) Requirement to explicitly declare the data type for every variable. Show Answer Correct Answer: C) Significant use of indentation (whitespace) to define code blocks. 28. What will be the result of the following import statement?from math import * A) Only the math module itself will be imported, but no functions or variables. B) A math module will be imported with the alias *. C) A specific subset of functions from the math module will be imported. D) All functions from the math module will be imported into the current namespace. Show Answer Correct Answer: D) All functions from the math module will be imported into the current namespace. 29. How do you add the value '9' to the end of a list called 'numbers'? A) Numbers.push(9). B) Numbers.insert(9). C) Numbers.append(9). D) Numbers.add(9). Show Answer Correct Answer: C) Numbers.append(9). 30. What does the 'append()' method do in a list? A) Sorts the list. B) Removes an element from the list. C) Adds an element to the end of the list. D) Clears the list. Show Answer Correct Answer: C) Adds an element to the end of the list. 31. What will be the output of the following code?total = 0for i in range(1, 4):total += iprint(total) A) 10. B) 6. C) Error. D) 3. Show Answer Correct Answer: B) 6. 32. Which Python keyword is used to handle an alternative condition that should be checked only if the initial if statement is false? A) Else. B) Then. C) Switch. D) Elif. Show Answer Correct Answer: D) Elif. 33. What is the correct way to output "Hello, World!" in Python? A) Print('Hello, World!'). B) Echo 'Hello, World!'. C) Console.log('Hello, World!'). D) Print('Hello World!'). Show Answer Correct Answer: A) Print('Hello, World!'). 34. What does a cross platform language mean? A) 1512 22. B) 1512 24. C) 1513 22. D) X=10x=x+10x=x-5print (x)x, y =x-2, 22print (x, y). Show Answer Correct Answer: C) 1513 22. 35. Apa tujuan dari pernyataan 'if' dalam Python? A) Pernyataan 'if' digunakan untuk mendefinisikan fungsi dalam Python. B) Pernyataan 'if' digunakan untuk membuat loop dalam Python. C) Pernyataan 'if' digunakan untuk mengimpor modul dalam Python. D) Pernyataan 'if' memungkinkan eksekusi kode secara kondisional berdasarkan ekspresi boolean. Show Answer Correct Answer: D) Pernyataan 'if' memungkinkan eksekusi kode secara kondisional berdasarkan ekspresi boolean. 36. What is the first step to save a Python program? A) Select destination folder. B) Select Save option. C) Give file name. D) Click on File tab. Show Answer Correct Answer: D) Click on File tab. 37. Full form of IDLE A) Integrated Development Local Language. B) Integral Development Learning Environment. C) Invest Development Learning Language. D) Integrated Development & Learning Environment. Show Answer Correct Answer: D) Integrated Development & Learning Environment. 38. Which subprogram is used to set the color of the pen in the turtle library? A) Penup(). B) Pendown(). C) Pencolor(" ). D) Pensize(" ). Show Answer Correct Answer: C) Pencolor(" ). 39. Which arithmetic operator is used to calculate the remainder (or modulus) after division? A) *. B) /. C) %. D) //. Show Answer Correct Answer: C) %. 40. What is the output of this code? print("Hello", "World") A) HelloWorld. B) Hello World. C) "Hello", "World". D) None of the above. Show Answer Correct Answer: B) Hello World. 41. What is the big question in computer science? A) How do you eat an elephant?. B) How do you make and run a computer program in Python?. C) What are the main strands of computer science?. D) What skills does the computer science curriculum provide?. Show Answer Correct Answer: A) How do you eat an elephant?. 42. Python has a simple syntax similar to the A) Coding language. B) English language. C) Spanish language. D) None of the above. Show Answer Correct Answer: B) English language. 43. Comments help the programmer make ..... within the program without affecting the code. A) Changes. B) Revisions. C) A mess. D) Notes. Show Answer Correct Answer: D) Notes. 44. Which common error occurs when you forget a colon (:) after an if statement, for loop, or function definition? A) TypeError. B) NameError. C) SyntaxError. D) ValueError. Show Answer Correct Answer: C) SyntaxError. 45. What will be the output of the following code? "'pythonfruits = ['apple', 'banana', 'cherry']print(fruits[-1]) "' A) 'banana'. B) 'Error'. C) 'apple'. D) 'cherry'. Show Answer Correct Answer: D) 'cherry'. 46. The instructions in a program, when expressed in Python, ..... A) Can only be carried out by humans, as long as they understand Python. B) Can only be carried out by computers. C) Can be carried out by computers, as long as an interpreter is available. D) Can be carried out by humans, as long as they understand Python, and computers, as long as an interpreter is available. Show Answer Correct Answer: D) Can be carried out by humans, as long as they understand Python, and computers, as long as an interpreter is available. 47. What does the return statement without any arguments return? A) 0. B) False. C) None. D) Error. Show Answer Correct Answer: C) None. 48. What are the three main programming structures? A) Sequence, selection, iteration. B) Java, Python, Visual Basic. C) Structured, object-oriented, procedural. D) Machine, assembly, high-level. Show Answer Correct Answer: A) Sequence, selection, iteration. 49. Explain the concept of tuple assignment in Python with an example. A) A, b = [1, 2] results in a = 1 and b = 2. B) A, b = (1, 2, 3) results in a = 1 and b = 2. C) A, b = 1, 2 results in a = 1 and b = 2. D) Example:a, b = (1, 2) results in a = 1 and b = 2. Show Answer Correct Answer: D) Example:a, b = (1, 2) results in a = 1 and b = 2. 50. Complete the code:x= ..... (input("The first integer") A) Float. B) Integer. C) Bool. D) Int. Show Answer Correct Answer: D) Int. 51. In age = 13, what is the value? A) 13. B) Age. C) =. D) Print. Show Answer Correct Answer: A) 13. 52. What is the official form for the for loop in Python? A) For in:. B) For:. C) For in:. D) For:. Show Answer Correct Answer: A) For in:. 53. What's the value of the below code snippet?a, b, c = 1, 2, 3a, b, c = c, a, b = b, a, c = c, b, aprint(a, b, c) A) 1 3 2. B) 1 2 3. C) 3 2 1. D) 2 3 1. Show Answer Correct Answer: D) 2 3 1. 54. In what year was Python released? A) 1995. B) 2000. C) 1989. D) 1991. Show Answer Correct Answer: D) 1991. 55. What is the output of the following code? "'pythonprint("Hello World"[6:11]) "' A) World. B) Hello. C) O Wor. D) Worl. Show Answer Correct Answer: D) Worl. 56. You have animals = ("cat", "dog", "cat", "bird", "cat"). What is animals.count("cat")? A) 2 because pairs are combined. B) 4 because index starts at one. C) 1 because unique values counted. D) 3 because appears three times. Show Answer Correct Answer: D) 3 because appears three times. 57. Every flowchart has ..... A) Has words. B) Start and End. C) Numbers. D) Nothing. Show Answer Correct Answer: B) Start and End. 58. What will be the output of the following code?x, y, z = 1, 2, 3print (x + y + z) A) 6. B) 123. C) Error. D) 1, 2, 3. Show Answer Correct Answer: A) 6. 59. How do you import the Turtle module in Python? A) Import turtle module. B) Require turtle. C) From turtle import *. D) Import turtle. Show Answer Correct Answer: D) Import turtle. 60. Which arithmetic operator is used for exponentiation? A) **. B) +. C) *. D) //. Show Answer Correct Answer: A) **. ← 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 8Class 11 Computer Science Chapter 2 Introduction To Python Quiz 9 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books