This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 13 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 13 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Print("12"*3)What would this print? A) 24. B) 12*3. C) 36. D) 121212. Show Answer Correct Answer: D) 121212. 2. What will the output be from the following code?print(3+4) A) SyntaxError. B) Print(3+4). C) 3+4. D) 7. Show Answer Correct Answer: D) 7. 3. What does the 'len()' function return when applied to a string? A) Number of characters. B) ASCII value of the first character. C) Error. D) None. Show Answer Correct Answer: A) Number of characters. 4. Writing comments is mandatory in Python programs (T/F) A) Depends on the context. B) Not applicable. C) False. D) True. Show Answer Correct Answer: C) False. 5. What is the file extension of a Python program? A) .cpp. B) .py. C) .java. D) .txt. Show Answer Correct Answer: B) .py. 6. Print my ..... list[-1]my ..... list = [0, 1, 2, 3, 4, 5] A) 0. B) My list not defined. C) 5. D) -1. Show Answer Correct Answer: B) My list not defined. 7. How many 'else' blocks can an 'if-elif-else' chain have? A) Only one. B) As many as you want. C) Exactly two. D) None (Python doesn't allow 'else'). Show Answer Correct Answer: A) Only one. 8. What is the output of print 'Hello world!'? A) Hello world!. B) Hello. C) World!. D) None of the above. Show Answer Correct Answer: A) Hello world!. 9. What is the keyword to create a class? A) Def. B) Import. C) Class. D) Int . Show Answer Correct Answer: C) Class. 10. Which of the following statements is true about recursion in Python? A) A function used for infinite loops. B) A function that can call itself. C) A function must always return None. D) Recursion is not allowed in Python. Show Answer Correct Answer: B) A function that can call itself. 11. What is the output of the expression 3 + 4 * 2? A) 8. B) 10. C) 11. D) 14. Show Answer Correct Answer: C) 11. 12. Read the Python program below:number = 13if number < 10:print("small")if number < 100:print("medium")if number < 1000:print("large")When this program is executed, what will be displayed on the screen? A) Small. B) Medium. C) Mediumlarge. D) Large. Show Answer Correct Answer: C) Mediumlarge. 13. How to insert comments in Python? A) # this is a comment. B) // this is a comment. C) /* this is a comment */. D) None of the above. Show Answer Correct Answer: A) # this is a comment. 14. What function is used to take input from the user in Python? A) Read(). B) Write(). C) Scan(). D) Input(). Show Answer Correct Answer: D) Input(). 15. What is MicroPython optimized for? A) Scientific computing. B) Running on microcontrollers. C) High-level web development. D) Cloud computing. Show Answer Correct Answer: B) Running on microcontrollers. 16. What will be the output of the following code? print(type(3.14)) A) Float. B) Integer. C) String. D) None. Show Answer Correct Answer: A) Float. 17. What would happen if your forgot to include a colon at the end of an if statement? A) Compilation error. B) Logical error. C) Codes works. D) Syntax error. Show Answer Correct Answer: D) Syntax error. 18. What is the result of mistyping a command in Python? A) The program runs faster. B) The program displays a warning. C) The program gives an error message. D) The program ignores the typo. Show Answer Correct Answer: C) The program gives an error message. 19. Which of the following is a keyword in Python? A) Define. B) Function. C) Method. D) Def. Show Answer Correct Answer: D) Def. 20. Which of the following statements will correctly check if a number is even? A) If number / 2 == 0:. B) If number ** 2 == 0:. C) If number // 2 == 0:. D) If number % 2 == 0:. Show Answer Correct Answer: D) If number % 2 == 0:. 21. Select the tuple for which all() returns False. A) (True, 5, 'x'). B) (1, 2, 3). C) (0, 'b', 7). D) ('a', [1], 9). Show Answer Correct Answer: C) (0, 'b', 7). 22. What is a literal? A) Storage Device. B) Littering a country. C) A person who litters. D) Literals are a variety of data we use & store in computer program. Show Answer Correct Answer: D) Literals are a variety of data we use & store in computer program. 23. Comment statement in Python is A) /* */. B) #. C) /. D) '. Show Answer Correct Answer: B) #. 24. What will the following Python code output?print(2 + 3 * 4) A) 24. B) 14. C) 20. D) 18. Show Answer Correct Answer: B) 14. 25. An iterative statement is also known as a ..... statement. A) Looping. B) Conditional. C) Selection. D) None of the above. Show Answer Correct Answer: A) Looping. 26. Which one is used for division in Python? A) -. B) . C) :. D) /. Show Answer Correct Answer: D) /. 27. Python is most popular programming language. Based on the Stack Overflow Developer Survey 2021, which rank is Python in? A) 3rd. B) 1st. C) 4th. D) 2nd. Show Answer Correct Answer: A) 3rd. 28. In programming, what is iteration? A) Testing a program to make sure it works. B) A decision point in a program. C) The repetition of steps within a program. D) The order in which instructions are carried out. Show Answer Correct Answer: C) The repetition of steps within a program. 29. In which of the following loop in python, we can check the condition? A) For loop. B) While loop. C) Do while loop. D) None of the above. Show Answer Correct Answer: B) While loop. 30. Which of the following programs will print the 10 most frequently appearing words in a text file? A) A program that counts the frequency of each word and prints the top 10. B) A program that prints all words in alphabetical order. C) A program that prints the first 10 words in the file. D) A program that removes all duplicate words and prints the result. Show Answer Correct Answer: A) A program that counts the frequency of each word and prints the top 10. 31. What is the correct syntax for a for loop in Python to iterate over a list called 'my ..... list'? A) 'foreach i in my list:'. B) 'for (i in my list):'. C) 'for i = 0 to len(my list):'. D) 'for i in my list:'. Show Answer Correct Answer: D) 'for i in my list:'. 32. What is the correct way to ask the user for their name in Python and store it in a variable called 'name'? A) Input("What is your name?") = name. B) Name == input("What is your name?"). C) Name = input("What is your name?"). D) Name.input("What is your name?"). Show Answer Correct Answer: C) Name = input("What is your name?"). 33. To copy a list that contains other lists we can use which method of the copy module A) Clone(). B) Supercopy(). C) Shallowcopy(). D) Deepcopy(). Show Answer Correct Answer: D) Deepcopy(). 34. What data type is represented by the value 3.14? A) Int. B) Float. C) Str. D) Bool. Show Answer Correct Answer: B) Float. 35. What kind of applications can a Python programmer create? A) Websites and games. B) Poems. C) Sculptures. D) Garden designs. Show Answer Correct Answer: A) Websites and games. 36. In the example program, which Python function is used to get numeric input from the user before casting to float? A) Print(). B) Input(). C) Int(). D) Str(). Show Answer Correct Answer: B) Input(). 37. What is the output of the following Python code? name = "Alex" print("Hello", name) A) Hello, Alex. B) HelloAlex. C) Alex Hello. D) Hello Alex. Show Answer Correct Answer: D) Hello Alex. 38. Which of these is a correct string? A) Hello. B) 'Hello'. C) 'Hello. D) Hello". Show Answer Correct Answer: B) 'Hello'. 39. What data type is the result of the following expression:'5 + 3.0'? A) Integer. B) Boolean. C) Float. D) String. Show Answer Correct Answer: C) Float. 40. Which data type is used to store:TRUE A) Boolean. B) Integer. C) String. D) Double. Show Answer Correct Answer: A) Boolean. 41. Which of the following is the correct way to create a list containing the values 4, 5, and 6? A) List = "4, 5, 6". B) List = (4, 5, 6). C) List = [4, 5, 6]. D) List = {4, 5, 6}. Show Answer Correct Answer: C) List = [4, 5, 6]. 42. Aturan apa yang harus diperhatikan dalam memberi nama variabel dalam Python? A) Nama variabel harus diawali dengan huruf atau underscore ( ), tidak boleh dengan angka atau simbol lain. B) Nama variabel harus diakhiri dengan titik (.), koma (, ), atau tanda seru (!). C) Nama variabel harus menggunakan huruf kapital semua, misalnya NAMA. D) Nama variabel harus menggunakan spasi antara setiap kata, misalnya nama lengkap. Show Answer Correct Answer: A) Nama variabel harus diawali dengan huruf atau underscore ( ), tidak boleh dengan angka atau simbol lain. 43. When a value or text string entered in Interactive Mode it is immediately shown on the screen. A) QRU (quick response unit). B) Variable. C) Keyword. D) Echo. Show Answer Correct Answer: D) Echo. 44. What is the name of the environment in Python that write your programs and then test them out? A) CLI. B) IDLE. C) Shell. D) Window. Show Answer Correct Answer: B) IDLE. 45. What is the standard function used in Python to prompt the user to type in a value from the keyboard? A) Prompt ( ). B) Get ( ). C) Input ( ). D) Read ( ). Show Answer Correct Answer: C) Input ( ). 46. Write the output of the following code:s = None; s A) Shows Error. B) None of the above. C) None. D) Nothing will be printed. Show Answer Correct Answer: D) Nothing will be printed. 47. How are statements terminated in Python and most text-based programming languages? A) With a comma. B) With a full stop. C) With a semi-colon. D) With a question mark. Show Answer Correct Answer: C) With a semi-colon. 48. Which of the following will create a variable called 'temperature' and assign it the value $15^\circ$ A) Temperature = 15. B) Temperature == 15. C) Temperature:= 15. D) Temperature <-15. Show Answer Correct Answer: A) Temperature = 15. 49. What symbol would you use to add a comment to your code? A) //. B) #. C) -. D) ]]. Show Answer Correct Answer: B) #. 50. What will be the output of the following code? print(5 + 3 * 2) A) 13. B) 16. C) 11. D) 10. Show Answer Correct Answer: C) 11. 51. An error in a code is called a- A) Glitch. B) Error Code. C) Bug. D) Syntax Error. Show Answer Correct Answer: C) Bug. 52. Which is NOT a programming language. A) Jave. B) Microsoft. C) Python. D) C ++. Show Answer Correct Answer: B) Microsoft. 53. What will be the output of the following code? name = input("Enter your name: ") print("Hello, '' + name) A) Hello, Enter your name:. B) Hello, name. C) Error. D) Hello, followed by the user's input. Show Answer Correct Answer: D) Hello, followed by the user's input. 54. What is the main advantage of using Python for web development? A) Python is not suitable for web development. B) Python provides a robust framework for web development. C) Python is too complex for web development. D) Python is only used for desktop applications. Show Answer Correct Answer: B) Python provides a robust framework for web development. 55. The syntax in Python (TM) is one of the main advantages over other high level programming languages. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 56. Adding strings together is called ..... & ..... is used in it A) Division-**. B) Concatenation-+. C) Annotation-%. D) Joining-#. Show Answer Correct Answer: B) Concatenation-+. 57. A mini programme used inside a larger programme A) Variable. B) Algorithm. C) Concatenate. D) Function. Show Answer Correct Answer: D) Function. 58. To show some text on the screen in Python we can use the ..... function: A) Float(). B) Input(). C) Print(). D) Show(). Show Answer Correct Answer: C) Print(). 59. What is the correct way to open the file file ..... in.txt for reading? A) Open('file in.txt', 'w'). B) Open('file in.txt', 'r'). C) Open('file in.txt', 'a'). D) Open('file in.txt', 'r+'). Show Answer Correct Answer: B) Open('file in.txt', 'r'). 60. What are the two main types of loops in Python? A) Repeat until loop. B) Foreach loop. C) Do while loop. D) For loop, while loop. Show Answer Correct Answer: D) For loop, while loop. ← 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