This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 19 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 19 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What does an exception in Python refer to? A) A problem in the code. B) A good thing in the program. C) A successful execution. D) A user input. Show Answer Correct Answer: A) A problem in the code. 2. An example of a high-level programming language is: A) Machine code. B) Assembly. C) Cloud. D) Python. Show Answer Correct Answer: D) Python. 3. In the installation process shown, which option should be checked to ensure Python is added to the system PATH? A) Use admin privileges. B) Add python.exe to PATH. C) Customize installation. D) Install Now. Show Answer Correct Answer: B) Add python.exe to PATH. 4. What is the value of 'x' after the following code runs? "'pythonx = 10x = x + 5 "' A) 10. B) 20. C) 5. D) 15. Show Answer Correct Answer: D) 15. 5. Which operator is used in Python to divide one number by another and get the result as a decimal (floating point number)? A) /. B) //. C) %. D) . Show Answer Correct Answer: A) /. 6. Apa yang dilakukan fungsi 'len()' dalam Python? A) Fungsi 'len()' menghitung jumlah angka dalam sebuah daftar. B) Fungsi 'len()' mengembalikan jumlah item dalam sebuah objek. C) Fungsi 'len()' mengonversi sebuah objek menjadi string. D) Fungsi 'len()' memeriksa apakah sebuah objek kosong atau tidak. Show Answer Correct Answer: B) Fungsi 'len()' mengembalikan jumlah item dalam sebuah objek. 7. Generally speaking, a low level programming language is easier to read, write and maintain over a high level programming language A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 8. What is the purpose of a loop in programming? A) To define a variable. B) To repeat a block of code multiple times. C) To execute code once. D) To create a function. Show Answer Correct Answer: B) To repeat a block of code multiple times. 9. What is the input for the following code?Python iseasy A) Print( Python is easy). B) Print(" Python ")print("is")print("easy"). C) Print( Python is easy). D) None of the above. Show Answer Correct Answer: B) Print(" Python ")print("is")print("easy"). 10. What will be the output if the user inputs 15?def check ..... even ..... odd(number):if number % 2 == 0:return "Even" else:return "Odd"user ..... input = int(input("Enter a number: "))print(check ..... even ..... odd(user ..... input)) A) Even. B) Odd. C) Error. D) None. Show Answer Correct Answer: B) Odd. 11. Which subprogram would you use to fill a shape with color in the turtle library module? A) Turtle.home(). B) Turtle.setposition(, ). C) Turtle.hideturtle(). D) Turtle.fillcolor(). Show Answer Correct Answer: D) Turtle.fillcolor(). 12. Differentiate between identifiers and keywords. A) Identifiers are part of Python language, keywords are special words. B) Identifiers are special words, keywords are part of Python language. C) Identifiers are names of entities, keywords are reserved words. D) Identifiers are reserved words, keywords are names of entities. Show Answer Correct Answer: C) Identifiers are names of entities, keywords are reserved words. 13. Variable names are not case-sensitive.a = 5# is the same asA = 5 A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 14. Python is ..... typed, which means that the type of an object does not change A) Strongly. B) Weakly. C) Storage. D) None of the mentioned. Show Answer Correct Answer: A) Strongly. 15. A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly A) False. B) It means your code is running slowly. C) True. D) It indicates a logical error in the code. Show Answer Correct Answer: C) True. 16. Which of the following is the correct way to define a function in Python? A) Def myFunc():. B) Function myFunc():. C) Define myFunc():. D) Func myFunc():. Show Answer Correct Answer: A) Def myFunc():. 17. A price such as 3.65 pesos should be saved as what kind of variable? A) Integer. B) String. C) Float. D) Boolean. Show Answer Correct Answer: C) Float. 18. What is the result of 3**2 A) 9. B) 18. C) 6. D) 27. Show Answer Correct Answer: A) 9. 19. What does casting do? A) Magic. B) Joins strings together. C) Changes a data type. D) Raises a number to a power. Show Answer Correct Answer: C) Changes a data type. 20. Describe the structure of an if-elif-else statement. A) The structure is:if (condition) { // code } elif (condition) { // code } else { // code }. B) If (condition) { // code } else if (condition) { // code }. C) If (condition) { // code } else { // code } elif (condition) { // code }. D) If (condition) { // code } elseif (condition) { // code } else { // code }. Show Answer Correct Answer: A) The structure is:if (condition) { // code } elif (condition) { // code } else { // code }. 21. Fill in the blank:The Integer, Floating-Point, and String Data Types are introduced in ..... A) Module-3. B) Module-4. C) Module-1. D) Module-2. Show Answer Correct Answer: C) Module-1. 22. What is the meaning of the arithmetic operator '%' in programming? A) Subtraction. B) Multiplication. C) Modulus. D) Addition. Show Answer Correct Answer: C) Modulus. 23. An element of a programme which stores a value that can change as the programme is run A) Concatenate. B) Algorithm. C) Variable. D) Function. Show Answer Correct Answer: C) Variable. 24. The smallest individual unit in a program is called as A) Token. B) Lexical Unit. C) Both a and b. D) None of the above. Show Answer Correct Answer: C) Both a and b. 25. Python code runs ..... A) Bottom to top. B) Randomly. C) Line by line. D) None of the above. Show Answer Correct Answer: C) Line by line. 26. What is the function of the 'else' statement in selection constructs? A) It is executed if the 'if' condition is false. B) It is executed before the 'if' condition is checked. C) It is mandatory to use with 'elif'. D) It is used to repeat a command. Show Answer Correct Answer: A) It is executed if the 'if' condition is false. 27. What is the effect of the following import statement?from math import * A) Imports only specific functions from math module. B) Imports all functions from math module. C) Imports math module but does not include its functions. D) Imports the math module as an alias. Show Answer Correct Answer: B) Imports all functions from math module. 28. Which of the following is NOT a legal variable name A) Grade5. B) YourName. C) Time minute. D) #info. Show Answer Correct Answer: D) #info. 29. How do you ask an input from a user? A) Name = input("what is your name?"). B) Input = name("what is your name?"). C) Name = int("what is your name"). D) Name = input(what is your name?). Show Answer Correct Answer: A) Name = input("what is your name?"). 30. What will be the output of the following code? "'pythonx = input("Enter a number: ")print(type(x)) "' A) . B) . C) NAN. D) . Show Answer Correct Answer: D) . 31. What is the purpose of f-strings in Python? A) To define variables. B) To execute loops. C) To create functions. D) To format strings. Show Answer Correct Answer: D) To format strings. 32. Comments in Python program are ..... by interpreter A) Not executed. B) Executed. C) Shared. D) Given. Show Answer Correct Answer: A) Not executed. 33. What is the output of the following Python code? print("Hello, world!") A) Hello, world!. B) A syntax error. C) No output. D) None of the above. Show Answer Correct Answer: A) Hello, world!. 34. What will be the output of print(bool([]))? A) True. B) False. C) None. D) Error. Show Answer Correct Answer: B) False. 35. What will be the output?name = "Dave"print (name) A) Name. B) Dave. C) (name). D) 'Dave'. Show Answer Correct Answer: B) Dave. 36. What does "assignment" mean in Python? A) Storing a value in a variable using =. B) Checking if two things are equal using ==. C) Printing a value to the screen. D) Joining two strings together with +. Show Answer Correct Answer: A) Storing a value in a variable using =. 37. Which of the following is a correct 'for' loop in Python? A) 'for i in range(5):'. B) 'for i from 0 to 5'. C) 'for i to 5'. D) 'for (i = 0; i < 5; i++)'. Show Answer Correct Answer: A) 'for i in range(5):'. 38. What does it mean for Python to be dynamically typed? A) Variables must be declared with their types before use. B) Variables can change their types during runtime. C) Python automatically compiles the code. D) The code is written in modules. Show Answer Correct Answer: C) Python automatically compiles the code. 39. What type of error is demonstrated by the following code? x = "ABC" + 2 A) NameError. B) SyntaxError. C) TypeError. D) IndexError. Show Answer Correct Answer: C) TypeError. 40. Which is the best type of loop to write a file in? A) While loop. B) For loop. C) Repeat loop. D) None of the above. Show Answer Correct Answer: B) For loop. 41. What will happen if indentation is incorrect? A) An error will occur. B) The code will run. C) Nothing will happen. D) None of the above. Show Answer Correct Answer: A) An error will occur. 42. What operator would I need to divide 5 by 10? A) /. B) +. C) *. D) #. Show Answer Correct Answer: A) /. 43. What command would you use to move the turtle forward by 100 units? A) Forward(100). B) Step(100). C) Backward(100). D) Move(100). Show Answer Correct Answer: A) Forward(100). 44. What does the input() function return in Python? A) A string. B) A list. C) An integer. D) A float. Show Answer Correct Answer: A) A string. 45. What is the value of $2 + 3$ A) 23. B) 6. C) 5. D) 8. Show Answer Correct Answer: C) 5. 46. What are the applications of Python? A) Web development. B) Artificial intelligence. C) Data science. D) All of the above. Show Answer Correct Answer: D) All of the above. 47. What is the purpose of the 'import ' statement in a program? A) To export the specified library module from the program. B) To delete the specified library module from the program. C) To import the module into the current program. D) To modify the specified library module within the program. Show Answer Correct Answer: C) To import the module into the current program. 48. How can you take user input in Python? A) Input() function. B) Scan() function. C) Get() function. D) Read() function. Show Answer Correct Answer: A) Input() function. 49. How do you access the first element of a list named 'fruits'? A) 'fruits[1]'. B) 'fruits[-1]'. C) 'fruits[0]'. D) 'fruits.first()'. Show Answer Correct Answer: C) 'fruits[0]'. 50. Which data type below is an int? A) "hello world". B) True. C) 12.5. D) 12. Show Answer Correct Answer: D) 12. 51. Before you can use a powerful external module, such as the math library or a custom module, what must you do first in your Python script? A) Save the file as a .pyc extension. B) Use the include statement. C) Run the install command. D) Use the import statement. Show Answer Correct Answer: D) Use the import statement. 52. What is the comparison operator for 'equal to' in Python? A) <=>. B) !=. C) ==. D) <>. Show Answer Correct Answer: C) ==. 53. What is the output of the following Python code? x = 10x = x + 1print(x) A) 9. B) 12. C) 10. D) 11. Show Answer Correct Answer: D) 11. 54. Is an example of what data type? A) String. B) Float. C) Boolean. D) None of the above. Show Answer Correct Answer: B) Float. 55. Which generation of computers used Transistor based hardware? A) First Generation. B) Third Generation. C) Second Generation. D) Fourth Generation. Show Answer Correct Answer: C) Second Generation. 56. What is the correct syntax for an if statement? A) If (x == 5). B) If x = 5:. C) If x == 5. D) If x == 5:. Show Answer Correct Answer: D) If x == 5:. 57. In Python a list slice from start to end can be used to A) Sort the list. B) Reverse the list. C) Copy the list. D) Delete the list. Show Answer Correct Answer: C) Copy the list. 58. Perbedaan utama tuple dan list adalah ..... A) Tuple tidak dapat dimodifikasi. B) Tuple dapat dimodifikasi. C) Tuple hanya untuk angka. D) List tidak bisa diubah. Show Answer Correct Answer: A) Tuple tidak dapat dimodifikasi. 59. Data = "No Way!" The expression len(data) evaluates to: A) 8. B) 7. C) 6. D) None of the above. Show Answer Correct Answer: B) 7. 60. How do you check the number of rows in a DataFrame? A) Using the size property. B) Using the length() function. C) Using the count() method. D) Using the shape attribute. Show Answer Correct Answer: D) Using the shape attribute. ← 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