This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 15 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 15 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which of the following is a correct way to start a comment in Python? A) ". B) '// This is a comment'. C) '/* This is a comment */'. D) '# This is a comment'. Show Answer Correct Answer: D) '# This is a comment'. 2. Why Python is in demand? A) Simple syntax. B) Useful in embedded and cross platforms. C) It is the fastest performing programming language. D) It has fewer libraries. Show Answer Correct Answer: A) Simple syntax. 3. Which of the following is NOT a built-in data type in Python? A) Set. B) List. C) Array. D) Tuple. Show Answer Correct Answer: C) Array. 4. What is printed by the following statement?print("A" in "APCSP") A) True. B) False. C) Error. D) None of the above. Show Answer Correct Answer: A) True. 5. What will be the output of the following code?my ..... dict = {'name':'Alice', 'age':25}print(my ..... dict['name']) A) Alice. B) 25. C) Name. D) Error. Show Answer Correct Answer: A) Alice. 6. What is string concatenation used for? A) Turning text into a number. B) Joining text and variables to make a longer message. C) Checking if two values match. D) Making a variable permanent. Show Answer Correct Answer: B) Joining text and variables to make a longer message. 7. What data type is 12.0? A) Boolean. B) Float. C) String. D) Int. Show Answer Correct Answer: B) Float. 8. The instructions in a program ..... A) Can only be expressed using binary digits. B) Can be expressed in any language. C) Can be expressed in any language, as long as they are precise. D) Can only be expressed using a programming language. Show Answer Correct Answer: D) Can only be expressed using a programming language. 9. What is the output of the following code?name = input("Enter your name: ")print("Hello, '' + name + "!")(Assume the user enters "Alice") A) Hello, Alice!. B) Hello Alice!. C) Hello Alice. D) Hello, Alice. Show Answer Correct Answer: A) Hello, Alice!. 10. What is the correct way to declare a variable in Python? A) 'x = 10'. B) 'declare x = 10'. C) 'int x = 10'. D) 'var x = 10'. Show Answer Correct Answer: A) 'x = 10'. 11. Which is NOT a legal variable name? A) My-var = 20. B) Myvar = 20. C) My var = 20. D) Myvar = 20. Show Answer Correct Answer: A) My-var = 20. 12. Why is else placed at the end of an if-elif-else chain? A) It repeats earlier conditions. B) It catches any unmatched case. C) It runs before all checks. D) It stops the program immediately. Show Answer Correct Answer: B) It catches any unmatched case. 13. You receive data as a list:data = [9, 2, 9]. Which single call turns it into an immutable sequence? A) Tuple(data) makes a tuple. B) List(data) makes a tuple. C) Data.sort() makes a tuple. D) Sorted(data) makes a tuple. Show Answer Correct Answer: A) Tuple(data) makes a tuple. 14. A line of text that Python won't try to run as code A) Comment. B) Integer. C) Strings. D) Input. Show Answer Correct Answer: A) Comment. 15. What is Python commonly used for in AI? A) Python is primarily used for web development. B) Python is mainly used for game design. C) Python is often used for graphic design. D) Python is commonly used for machine learning, data analysis, and building AI applications. Show Answer Correct Answer: D) Python is commonly used for machine learning, data analysis, and building AI applications. 16. What is the output of the following code? "'pythonounces = 16print("There are", ounces, "ounces in a pint.") "' A) There are 16 in a pint ounces. B) There are ounces 16 in a pint. C) There are 16 ounces in a pint. D) There are "16" ounces in a pint. Show Answer Correct Answer: C) There are 16 ounces in a pint. 17. Which of the following is a valid way to assign multiple values to variables in Python? A) X = 1, y = 2. B) X, y = 1, 2. C) X, y = [1, 2]. D) X = (1, 2). Show Answer Correct Answer: B) X, y = 1, 2. 18. Which data type is used to store text? A) Bool. B) Float. C) Str. D) Int. Show Answer Correct Answer: C) Str. 19. What will the following code output? print('Hello' + str(5)) A) Hello5. B) 5Hello. C) Error. D) Hello 5. Show Answer Correct Answer: A) Hello5. 20. Which of the following is used to store a sequence of items in Python? A) Integer. B) List. C) Float. D) String. Show Answer Correct Answer: B) List. 21. What does turn(90) do? A) Turns left 90 degrees. B) Moves forward 90. C) Does nothing as 'turn' is not a turtle instruction. D) Turns right 90 degrees. Show Answer Correct Answer: C) Does nothing as 'turn' is not a turtle instruction. 22. What command is used to run a Python script in IDLE? A) Ctrl + R. B) F5. C) Alt + S. D) Shift + Enter. Show Answer Correct Answer: B) F5. 23. The boolean expression True or Falseevaluates to: A) "". B) True. C) False. D) Or. Show Answer Correct Answer: B) True. 24. What is the output of the following code? "'pythonprint(7 + 3) "' A) 73. B) 1.0. C) 7 + 3. D) 10. Show Answer Correct Answer: D) 10. 25. Which of the following represents "equal to" in Python? A) ==. B) =/=. C) !=. D) <>. Show Answer Correct Answer: A) ==. 26. What does the 'values' attribute of a DataFrame return? A) A NumPy array containing all the values in the DataFrame. B) A list of column names in the DataFrame. C) A dictionary representation of the DataFrame. D) A Pandas Series of the first column in the DataFrame. Show Answer Correct Answer: A) A NumPy array containing all the values in the DataFrame. 27. Which of these is NOT a core component of a computer? A) Storage (Hard Drive/SSD). B) A Computer Program. C) Memory (RAM). D) CPU (Processor. Show Answer Correct Answer: B) A Computer Program. 28. What is the correct way to exit a while loop prematurely in Python? A) 'break'. B) 'exit'. C) 'terminate'. D) 'stop'. Show Answer Correct Answer: A) 'break'. 29. Choose the correct syntax for lambda function. A) Lambda x, y:return x + y. B) Def lambda x, y:x + y. C) Lambda x, y = x + y. D) Lambda x, y:x + y. Show Answer Correct Answer: D) Lambda x, y:x + y. 30. How can you make an exception more reusable in Python? A) By defining multiple exceptions. B) By using the 'raise' keyword. C) By adding parameters to a function. D) By using the 'pass' keyword. Show Answer Correct Answer: C) By adding parameters to a function. 31. How do you create your own module in Python? A) By defining functions in a .py file. B) By using the module keyword. C) By importing built-in modules. D) By using the def keyword inside a file. Show Answer Correct Answer: A) By defining functions in a .py file. 32. What extension must you add to the end of a file when saving? A) .pyc. B) .py. C) .c. D) .java. Show Answer Correct Answer: B) .py. 33. The items listed in the parenthesis of a procedure definition are called ..... A) Parameters. B) Variables. C) Comments. D) Scripts. Show Answer Correct Answer: A) Parameters. 34. A programmer types flt(price), what type of data are they assigning to the price? A) Float. B) Boolean. C) String. D) Integer. Show Answer Correct Answer: A) Float. 35. What is the result of the expression '5 + 3 * 2' in Python? A) 10. B) 13. C) 16. D) 11. Show Answer Correct Answer: D) 11. 36. Which operator is used for division? A) -. B) /. C) %. D) //. Show Answer Correct Answer: B) /. 37. Bagaimana cara menyisipkan komentar dalam kode Python? A) Gunakan '//' untuk komentar dalam Python dan '"""' untuk komentar multi-baris. B) Gunakan '#' untuk komentar satu baris dan triple quotes untuk komentar multi-baris. C) Gunakan '//' untuk komentar satu baris dan '/* */' untuk komentar multi-baris. D) Gunakan '/*' untuk komentar satu baris dan '#' untuk komentar multi-baris. Show Answer Correct Answer: B) Gunakan '#' untuk komentar satu baris dan triple quotes untuk komentar multi-baris. 38. Which of the following is NOT a sequence type in Python? A) String. B) Tuple. C) Dictionary. D) List. Show Answer Correct Answer: C) Dictionary. 39. Which of the following statements is true about Python lists? A) Lists are immutable. B) Lists cannot be nested. C) Lists can contain mixed data types. D) Lists are defined using {}. Show Answer Correct Answer: C) Lists can contain mixed data types. 40. Which of the following is the correct way to convert a string '"25"' to an integer in Python? A) Str(25). B) Int("25"). C) 25("int"). D) Float("25"). Show Answer Correct Answer: B) Int("25"). 41. What is the file format of Jupyter Notebook(Google Colab)? A) .ipynb. B) .py. C) , js. D) .jpg. Show Answer Correct Answer: A) .ipynb. 42. What is the purpose of the requestString() function? A) To request user input as a string. B) To print a string. C) To define a variable. D) None of the above. Show Answer Correct Answer: A) To request user input as a string. 43. How do you create a variable in Python? A) Create a variable by writing 'variable name $\rightarrow$ value'. B) Declare a variable using 'value = variable name'. C) Assign a value with 'variable name:value'. D) Use the syntax 'variable name = value' to create a variable. Show Answer Correct Answer: D) Use the syntax 'variable name = value' to create a variable. 44. What is an error? A) When your program has a problem. B) A type of variable. C) A programming function. D) None of the above. Show Answer Correct Answer: A) When your program has a problem. 45. Which of the following is a loop in Python? A) 'elif'. B) 'else'. C) 'for'. D) 'if'. Show Answer Correct Answer: C) 'for'. 46. What is the data type of L if L = [1, 'Python', 2.5]? A) List. B) Dictionary. C) String. D) Tuple. Show Answer Correct Answer: A) List. 47. How can you import only specific functions from a module? A) From module name import function name. B) From function name import module name. C) Import module name.function name. D) Import function from module name. Show Answer Correct Answer: A) From module name import function name. 48. Example of valid identifiers A) Total marks. B) Name$. C) Total-mark. D) 12Name. Show Answer Correct Answer: A) Total marks. 49. What is a programming language? A) English. B) A language for babies. C) A programming language is a vocabulary and a set a set of grammatical rules for instructing a computer or computing a device to perform specific tasks. D) A computer language. Show Answer Correct Answer: C) A programming language is a vocabulary and a set a set of grammatical rules for instructing a computer or computing a device to perform specific tasks. 50. Which line correctly converts a string to an integer? A) Int = "5". B) Score = "int(5)". C) Score = input("5"). D) Score = int("5"). Show Answer Correct Answer: D) Score = int("5"). 51. Which of the following is a valid way to comment in Python? A) // This is a comment. B) . C) # This is a comment. D) /* This is a comment */. Show Answer Correct Answer: C) # This is a comment. 52. What happens when you type print("3" + "4")? A) 7. B) 3+4. C) 34. D) Error. Show Answer Correct Answer: C) 34. 53. What is Python described as? A) A video game. B) A math tool. C) A type of snake. D) A programming language. Show Answer Correct Answer: D) A programming language. 54. What does the following code display?a = 1b = 2print(a + a) A) 3. B) 22. C) 4. D) 2. Show Answer Correct Answer: D) 2. 55. What is the output of the following code? "'pythonprint(len("Python")) "' A) 7. B) Error. C) 5. D) 6. Show Answer Correct Answer: D) 6. 56. Which of the following is NOT a programming paradigm supported by Python? A) Assembly programming. B) Procedural programming. C) Functional programming. D) Object-oriented programming. Show Answer Correct Answer: A) Assembly programming. 57. Which of the following is a boolean value in Python? A) 1. B) True. C) "True". D) True. Show Answer Correct Answer: B) True. 58. To repeat a task many times, we use a: A) While loop. B) Print. C) Return. D) If. Show Answer Correct Answer: A) While loop. 59. What is syntax in programming? A) The output of the code. B) A type of error. C) A programming language. D) The structure and rules that govern how code is written. Show Answer Correct Answer: D) The structure and rules that govern how code is written. 60. Which of the following is NOT a logical operator in Python? A) And. B) Or. C) Not. D) Xor. Show Answer Correct Answer: D) Xor. ← 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