This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 6 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 6 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What does the 'len()' function do in Python? A) The 'len()' function sorts the items in a collection. B) The 'len()' function returns the number of items in an object. C) The 'len()' function calculates the sum of numbers in a list. D) The 'len()' function converts an object to a string. Show Answer Correct Answer: B) The 'len()' function returns the number of items in an object. 2. What will the output be from the following code?print("Hello world!" * 2) A) Hello world world!. B) Hello world!Hello world!. C) TypeError. D) Hello world! * 2. Show Answer Correct Answer: B) Hello world!Hello world!. 3. What does Python turtle allow you to do? A) Draw using Java. B) Insert Audio. C) Edit photo. D) Draw using python. Show Answer Correct Answer: D) Draw using python. 4. What programming language do web developers use to create dynamic web applications besides HTML and CSS? A) Algebra. B) French. C) Spanish. D) Python. Show Answer Correct Answer: D) Python. 5. You want three different messages for weather: "rainy", "sunny", or "snowy" . Which structure should you use? A) An if, elif, and else chain. B) An if with else for all three cases. C) Only one if statement with no else. D) Two separate else blocks in a row. Show Answer Correct Answer: A) An if, elif, and else chain. 6. Which of the following is a list in Python? A) [1, 2, 3]. B) {1, 2, 3}. C) <1, 2, 3>. D) (1, 2, 3). Show Answer Correct Answer: A) [1, 2, 3]. 7. What is PEP 8 in Python? A) PEP 8 is a Python library for data analysis. B) PEP 8 is a version of Python released in 2020. C) PEP 8 is a tool for debugging Python code. D) PEP 8 is the Python Enhancement Proposal that outlines the style guide for Python code. Show Answer Correct Answer: D) PEP 8 is the Python Enhancement Proposal that outlines the style guide for Python code. 8. What is a variable defined inside a function referred to as? A) An automatic variable. B) A global variable. C) A volatile variable. D) A local variable. Show Answer Correct Answer: D) A local variable. 9. What data type is the variable result in the following code?result = 10 + 2.5 A) Floating Point. B) String. C) Boolean. D) Integer. Show Answer Correct Answer: A) Floating Point. 10. What will print(2 / 0) output? A) 0. B) Infinity. C) Error. D) None. Show Answer Correct Answer: C) Error. 11. What will be the output of the following code? "'pythonx = 3y = 4if x > 2 and y < 5:print("Yes")else:print("No") "' A) 3. B) Yes. C) Error. D) No. Show Answer Correct Answer: B) Yes. 12. The print() function can be used to add numbers only. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 13. Select the correct input command below A) Input(" "). B) Input(" . C) Input(. D) Input. Show Answer Correct Answer: A) Input(" "). 14. What is the output of the following code? print(type(10)) A) . B) . C) . D) . Show Answer Correct Answer: B) . 15. What type of language is Python? A) Markup language for data presentation. B) Low-level, compiled programming language. C) Scripting language for web development. D) High-level, interpreted programming language. Show Answer Correct Answer: D) High-level, interpreted programming language. 16. What will be the output of the following code? "'pythonif 3 > 2:print("Yes")else:print("No") "' A) Yes. B) No. C) Error. D) None. Show Answer Correct Answer: A) Yes. 17. A Python data type that holds positive and negative whole numbers A) Int. B) Str. C) String. D) Input. Show Answer Correct Answer: A) Int. 18. What is the output of the following code? "'pythonx = "Python"print(x[0]) "' A) N. B) Y. C) P. D) T. Show Answer Correct Answer: C) P. 19. Which one is Karel command? A) Turn left(). B) Turn Left. C) TurnLeft. D) Turn right(). Show Answer Correct Answer: A) Turn left(). 20. What are some popular programming languages mentioned? A) HTML, CSS, JavaScript. B) Ruby, Swift, Go. C) Python, Java, C++. D) PHP, SQL, Perl. Show Answer Correct Answer: C) Python, Java, C++. 21. What happens during the program compilation process? A) The program is run directly without any changes. B) The program is stored in a database. C) The program is converted from machine code to human-readable code. D) The program is converted from human-readable code to machine-readable code. Show Answer Correct Answer: D) The program is converted from human-readable code to machine-readable code. 22. What is the output of the following code?x = 5if x > 3:passelse:print("Hello") A) Hello. B) No output. C) Error. D) None. Show Answer Correct Answer: B) No output. 23. A statement in programming A) Expresses an action to be carried out. B) Always returns results like expressions. C) Rules controlling how components in a program are combined. D) An instruction to perform a task, usually one word. Show Answer Correct Answer: A) Expresses an action to be carried out. 24. Where was Guido van Rossum born? A) Silicon Valley. B) Haarlem, the Netherlands. C) Hollywood. D) New York City. Show Answer Correct Answer: B) Haarlem, the Netherlands. 25. What does len([1, 2, 3]) return? A) 1. B) 3. C) Error. D) 2. Show Answer Correct Answer: A) 1. 26. What does the 'pop()' method do in a list? A) Adds an element to the list. B) Removes the last element from the list. C) Returns the first element of the list. D) Sorts the list. Show Answer Correct Answer: B) Removes the last element from the list. 27. In Python, ..... does not copy a value; it just attaches a name to the object that contains the data. A) Variable. B) Application. C) Allocation. D) Assignment. Show Answer Correct Answer: D) Assignment. 28. What is the traditional implementation of Python called? A) Python C. B) Python PSF. C) CPython. D) Guido Python. Show Answer Correct Answer: C) CPython. 29. What does the 'continue' statement do in a loop? A) It restarts the loop from the beginning. B) It pauses the loop for a specified time. C) It skips the current iteration and continues with the next one. D) It exits the loop completely. Show Answer Correct Answer: C) It skips the current iteration and continues with the next one. 30. What is a syntax error in Python? A) An error that occurs when a variable is not defined. B) An error that occurs when the code does not follow the correct structure. C) An error that occurs when a file is not found. D) An error that occurs when a function is not called. Show Answer Correct Answer: B) An error that occurs when the code does not follow the correct structure. 31. What is an if statement in Python? A) An if statement is used to define a function in Python. B) An if statement in Python is a type of loop. C) An if statement in Python is a control structure that executes a block of code if a specified condition is true. D) An if statement is a way to declare variables in Python. Show Answer Correct Answer: C) An if statement in Python is a control structure that executes a block of code if a specified condition is true. 32. Which of the following is a valid string in Python? A) "Hello". B) [Hello]. C) {Hello}. D) All of the above. Show Answer Correct Answer: A) "Hello". 33. What is the result of 10 % 3? A) 10. B) 1. C) 3. D) 0. Show Answer Correct Answer: B) 1. 34. What will print(10 // 3) output? A) 4. B) 3.3. C) 3. D) 1. Show Answer Correct Answer: C) 3. 35. Input() function takes the input from the user and always returns it as a: A) List. B) Number. C) Tuple. D) String. Show Answer Correct Answer: D) String. 36. What is the result of the expression 10-4 in Python? A) 5. B) 6. C) 7. D) 4. Show Answer Correct Answer: B) 6. 37. Which is the correct syntax? A) Has dog = true. B) Has dog = True. C) HAS DOG = tRue. D) Has dog = Treu. Show Answer Correct Answer: B) Has dog = True. 38. What does the following code do? myAge = int (myAge) A) Converts the var (variable) myAge from a integer to a string. B) Converts the var (variable) myAge to a string. C) Converts the var (variable) myAge to a integer. D) Converts the var (variable) myAge to if statement. Show Answer Correct Answer: C) Converts the var (variable) myAge to a integer. 39. What is the value of 'result' after the following code is executed? "'pythonresult = 15-4 "' A) 9. B) 7. C) 19. D) 11. Show Answer Correct Answer: D) 11. 40. The term which describes errors in a programme which are due to the programmers algorithm and calculations being wrong A) Debug. B) Bug. C) Syntax. D) Syntax error. E) Logic error. Show Answer Correct Answer: E) Logic error. 41. What symbol is used to join (concatenate) variables in Python? A) /. B) *. C) +. D) -. Show Answer Correct Answer: C) +. 42. Read the Python program below:print(a, b)b = 42a = 13When this program is executed, what will be displayed on the screen? A) 13 42. B) 42 13. C) There is an error in the program because variables a and b are not assigned values in the right order. D) There is an error in the program because when line 1 is executed, variables a and b have not been assigned values. Show Answer Correct Answer: D) There is an error in the program because when line 1 is executed, variables a and b have not been assigned values. 43. Which of the following statements about variables in Python is TRUE? A) Variable names can contain spaces. B) Variable names must always be written in capital letters. C) Variable names are case-sensitive. D) Variable names can start with a number. Show Answer Correct Answer: C) Variable names are case-sensitive. 44. What is the backdrop area called in Scratch? A) Stage. B) Ground. C) Paint. D) Area. Show Answer Correct Answer: A) Stage. 45. After converting a tuple to a list for editing, which operation is appropriate before restoring immutability? A) Use tuple.pop to delete last item. B) Use list.append on the tuple. C) Use remove to delete specific items. D) Use count to change values. Show Answer Correct Answer: C) Use remove to delete specific items. 46. What are syntax errors in programming? A) Errors in the execution of a program. B) Errors in the logic of a program. C) Errors in the display of messages. D) Errors in the translation of a program. Show Answer Correct Answer: D) Errors in the translation of a program. 47. What is a string in programming? A) A type of error. B) A data type that represents text enclosed in quotation marks. C) A type of loop. D) A number data type. Show Answer Correct Answer: B) A data type that represents text enclosed in quotation marks. 48. The term which describes identifying errors in a programme and fixing them A) Syntax. B) Debug. C) Bug. D) Syntax error. E) Logic error. Show Answer Correct Answer: B) Debug. 49. What is a program in computer science? A) A set of precise instructions. B) A programming language. C) A problem-solving method. D) A machine that executes instructions. Show Answer Correct Answer: A) A set of precise instructions. 50. What happens if you use else with a for loop? A) Executes only when the loop condition is true. B) Executes when the loop is finished without a break. C) Executes when the loop ends with a break. D) Causes an error. Show Answer Correct Answer: B) Executes when the loop is finished without a break. 51. Which one checks if something is true? A) If. B) For. C) Print. D) Loop. Show Answer Correct Answer: A) If. 52. Which of the following is a method of a list in Python? A) Append(). B) Add(). C) All of the above. D) Insert(). Show Answer Correct Answer: C) All of the above. 53. Which of the following is a Python command word used to indicate we want to work with WHOLE numbers/Integers A) Print. B) Float. C) Input. D) Int. Show Answer Correct Answer: D) Int. 54. What is wrong with this line of code?print("Hi) A) Missing quotation mark. B) Brackets not closed. C) Nothing is wrong. D) Indentation error. Show Answer Correct Answer: A) Missing quotation mark. 55. Comments in Python are written with a special character, which one? A) Brackets. B) Hashtag. C) Coma. D) None of the above. Show Answer Correct Answer: B) Hashtag. 56. What is a computer program? A) A device used for storing data. B) A set of instructions written to perform a specific task. C) A physical part of the computer. D) A type of computer virus. Show Answer Correct Answer: B) A set of instructions written to perform a specific task. 57. What will the following code print? "'pythonfor i in range(3):print("Python") "' A) Python. B) Python Python Python. C) Error. D) Python Python. Show Answer Correct Answer: B) Python Python Python. 58. What button do you press to compile (run) your program so that it runs in the shell? A) F5. B) F9. C) F3. D) F7. Show Answer Correct Answer: A) F5. 59. What is the output of the given Python code:print("ab", "cd", "ef", sep='*') A) Ab*cd*ef. B) Ab cd ef. C) Ab*cd*ef*. D) Ab, cd, ef. Show Answer Correct Answer: A) Ab*cd*ef. 60. Which symbol stands for divide? A) -. B) +. C) *. D) /. Show Answer Correct Answer: D) /. ← 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 7Class 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