This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 2 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 2 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Def maximum(x, y):if x > y:return xelif x == y:return 'The numbers are equal'else:return y print(maximum(2, 3)) A) 2. B) 3. C) Numbers are equal. D) None. Show Answer Correct Answer: B) 3. 2. Which of the following data structures in Python are mutable (can be modified later after being created)?List, Dictionary, Tuple A) Only List. B) Tuple and Dictionary. C) List and Tuple. D) List and Dictionary. Show Answer Correct Answer: D) List and Dictionary. 3. Insert the missing part of the code below to output ..... "My name is ". A) Print. B) PRINT. C) Print. D) None of the above. Show Answer Correct Answer: A) Print. 4. How do you check if a DataFrame contains any missing values? A) Using the isnull() method. B) Using the isna() method. C) Using the dropna() method. D) Using the fillna() method. Show Answer Correct Answer: A) Using the isnull() method. 5. What is the purpose of a function in programming? A) To perform a specific task. B) To confuse programmers. C) To slow down program execution. D) To hide errors. Show Answer Correct Answer: A) To perform a specific task. 6. What is the purpose of the 'print' command in Python? A) To display text on the screen. B) To run the program. C) To save the program. D) To print documents. Show Answer Correct Answer: A) To display text on the screen. 7. What is the purpose of creating a folder to save files in Python? A) To delete unnecessary files. B) To organize and store files. C) To increase computer speed. D) To create a backup of files. Show Answer Correct Answer: B) To organize and store files. 8. Which Python statement can be used to catch an Error? A) While. B) Return. C) Try except. D) Global. Show Answer Correct Answer: C) Try except. 9. Python is case sensitive (T/F) A) False. B) True. C) Not applicable. D) Depends on the context. Show Answer Correct Answer: B) True. 10. Which character is used in Python to make a single line comment? A) #. B) !. C) /. D) //. Show Answer Correct Answer: A) #. 11. What does the following Python code do?if user == "Elizabeth":print("Good morning Your Majesty")else:print("Hello", user) A) Checks if the user is Elizabeth and prints a personalized greeting. B) Prints "Hello" followed by the user's name for all inputs. C) Compares if two variables are equal. D) Always prints "Good morning Your Majesty.". Show Answer Correct Answer: A) Checks if the user is Elizabeth and prints a personalized greeting. 12. ..... is used to define a block of code in programming. A) A tab . B) A script . C) A text . D) An indentation . Show Answer Correct Answer: D) An indentation . 13. What will print(3 + 2) show? A) 32. B) 3+2. C) 5. D) 7. Show Answer Correct Answer: C) 5. 14. What will be printed by the following code? "'pythonlength = 10width = 5print(length * width) "' A) 50. B) 2. C) 105. D) 15. Show Answer Correct Answer: A) 50. 15. How do you access the third element in a list called 'colours'? A) 'colours[-3]'. B) 'colours[1]'. C) 'colours[3]'. D) 'colours[2]'. Show Answer Correct Answer: D) 'colours[2]'. 16. What is one of the goals defined by Guido van Rossum for Python's code? A) To be as complex as possible. B) To be as exclusive as possible. C) To be as understandable as plain English. D) To prioritize long development times. Show Answer Correct Answer: C) To be as understandable as plain English. 17. What colour is the information that is that is displayed in the shell? A) Brown. B) Purple. C) Green. D) Blue. Show Answer Correct Answer: D) Blue. 18. What does the relational operator '<=' represent? A) Less than. B) Less than or equal to. C) Greater than. D) Equal to. Show Answer Correct Answer: B) Less than or equal to. 19. All keywords in Python are in lower case (T/F). A) Depends on the context. B) Not applicable. C) False. D) True. Show Answer Correct Answer: C) False. 20. Is python an object oriented language? A) Yes. B) No. C) All the above. D) None of the above. Show Answer Correct Answer: A) Yes. 21. An expression can often be evaluated as true or false, for instance print(10>9) would return as true. What is this an example of? A) A string. B) A boolean value. C) A float. D) None of the above. Show Answer Correct Answer: B) A boolean value. 22. What is a correct syntax to get output as "Hello World" in Python? A) Print("Hello World"). B) Echo("hello world"). C) PRINT("Hello World"). D) Print("hello world"). Show Answer Correct Answer: D) Print("hello world"). 23. How do you specify a default value for an argument in a function? A) By declaring the argument as a global variable. B) By assigning a value to the parameter in the function definition. C) By initializing the argument inside the function body. D) By using the default keyword. Show Answer Correct Answer: B) By assigning a value to the parameter in the function definition. 24. The operator < means A) Greater than. B) Less than. C) Equal to. D) None of the above. Show Answer Correct Answer: B) Less than. 25. Which of the following would be an example of an integer variable: A) Name = "Bilbo". B) Pi = 3.14159265359. C) GuessCount = 100. D) ValidInput = False. Show Answer Correct Answer: C) GuessCount = 100. 26. You can declare string variables with single or double quotes.x = "John"# is the same asx = 'John' A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 27. Which one is a correct way to get user input? A) Say(). B) Question(). C) Input(). D) Ask(). Show Answer Correct Answer: C) Input(). 28. What is the output of print(type(5)) in Python? A) . B) . C) . D) . Show Answer Correct Answer: A) . 29. What is the purpose of the 'def' keyword in Python? A) To define a function. B) To import a module. C) To create a loop. D) To declare a variable. Show Answer Correct Answer: A) To define a function. 30. How do you take input from a user in Python? A) 'input()'. B) 'get()'. C) 'read()'. D) 'scan()'. Show Answer Correct Answer: A) 'input()'. 31. Python is named after: A) A book. B) A snake. C) A TV comedy show. D) A movie. Show Answer Correct Answer: C) A TV comedy show. 32. Which of the following is NOT a common application of Python? A) Game Development. B) Web Development. C) Hardware Design. D) Machine Learning. Show Answer Correct Answer: C) Hardware Design. 33. Why data analysis is important? A) Widely used in popular websites. B) Know the trend. C) Use to plan for next action. D) ALL of the answers stated. Show Answer Correct Answer: D) ALL of the answers stated. 34. No, a function can only have one return statement A) No, a function can only have one return statement. B) No, return statements are not allowed in functions. C) Yes, and all return statements will execute. D) Yes, but only one return statement will execute. Show Answer Correct Answer: D) Yes, but only one return statement will execute. 35. What is the result of the following operation:$10 / 4$ A) 2. B) 2.5. C) 2.0. D) 25. Show Answer Correct Answer: B) 2.5. 36. Which print statement correctly prints a variable called place ..... of ..... birth? A) Print("place of birth = London"). B) Print(place of birth). C) Print("place of birth"). D) Print("Middlesbrough"). Show Answer Correct Answer: B) Print(place of birth). 37. Used to structure code in Python A) Variables. B) Booleans. C) Whitespace. D) Comments. Show Answer Correct Answer: C) Whitespace. 38. Who developed the Python Programming language? A) Tim Berners-Lee. B) Ronald Reagan. C) Bill Gates. D) Guido van Rossum. Show Answer Correct Answer: D) Guido van Rossum. 39. The ..... operator checks whether a given value lies within a given set of values A) Between. B) Range. C) In. D) None of the above. Show Answer Correct Answer: C) In. 40. To get the last element from a list in Python we can use which index? A) -2. B) 9999. C) -1. D) 0. Show Answer Correct Answer: C) -1. 41. A data type consisting of numbers letters and symbols: A) Float. B) String. C) Boolean. D) Integer. Show Answer Correct Answer: B) String. 42. Which of the following is a key feature of Python? A) Static typing. B) Compiled language. C) Low-level language. D) Object-oriented. Show Answer Correct Answer: D) Object-oriented. 43. What statement can we use to check more conditions in an if ..... else statement? A) True. B) Else if. C) Elif. D) Len(). Show Answer Correct Answer: C) Elif. 44. Which of these is used to group code together in Python? A) Tabs or spaces. B) Periods. C) Slashes. D) Commas. Show Answer Correct Answer: A) Tabs or spaces. 45. You need an ordered container for values that must not change after creation. Which Python data type best fits this need? A) Dictionary, key-value and mutable. B) Tuple, ordered and immutable. C) List, ordered and mutable. D) Set, unordered and mutable. Show Answer Correct Answer: B) Tuple, ordered and immutable. 46. ..... is a set of valid characters that a language can recognize. A) Variables. B) Literals. C) Keywords. D) Character set. Show Answer Correct Answer: D) Character set. 47. What is the output of the following code?def my ..... func ( ):return 5return 10print (my ..... func ( ) ) A) None. B) 5. C) 10. D) Both 5 and 10. Show Answer Correct Answer: B) 5. 48. True or False:The output of the following code will always be the same.from random import randintdiceroll = randint(1, 6)print("You rolled a", diceroll) A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 49. What is the result of the following code? "'pythonnumbers = [7, 8, 9]print(len(numbers)) "' A) 9. B) 4. C) 2. D) 3. Show Answer Correct Answer: D) 3. 50. What will be the output after the following statements?x = 6 y = 3 print(x / y) A) 18. B) 2.0. C) 2. D) 18.0. Show Answer Correct Answer: B) 2.0. 51. What does the split() function do in Python? A) It combines a list of words into a string. B) It splits a string into a list of words. C) It removes spaces from a string. D) It counts the number of words in a string. Show Answer Correct Answer: B) It splits a string into a list of words. 52. What will be the output of the following code:print('Hello' + ' World')? A) HelloWorld. B) Hello, World. C) Hello World. D) Hello World!. Show Answer Correct Answer: C) Hello World. 53. Which function is used to convert a number to a string? A) Str(). B) Float(). C) Chr(). D) Int(). Show Answer Correct Answer: A) Str(). 54. What operator would I need to times 5 by 10? A) +. B) -. C) *. D) /. Show Answer Correct Answer: C) *. 55. What is the output of the following code? "'pythonprint("Great Britain" .replace("Great", "United")) "' A) United. B) GreatBritain. C) United Britain. D) Great Britain. Show Answer Correct Answer: C) United Britain. 56. What is the data type of the value '"42"' in Python? A) Float. B) Int. C) Bool. D) Str. Show Answer Correct Answer: D) Str. 57. Used to make comments in a line of python code? A) %. B) #. C) (). D) **. Show Answer Correct Answer: B) #. 58. To insert an the string "strawberries" in the first position of a list we use A) Fruit.insert(1, "strawberries"). B) Fruit.append("strawberries, 1"). C) Fruit.insert(0, "strawberries"). D) Fruit.insert("strawberries", 0). Show Answer Correct Answer: C) Fruit.insert(0, "strawberries"). 59. Module-1:Which of the following is NOT mentioned as a function topic in Module-1? A) Def Statements with Parameters. B) Return Values and return Statements. C) None Value. D) Web Scraping. Show Answer Correct Answer: D) Web Scraping. 60. How do you create a table in SQL? A) CREATE TABLE. B) MAKE TABLE. C) ADD TABLE. D) NEW TABLE. Show Answer Correct Answer: A) CREATE TABLE. ← 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 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 8Class 11 Computer Science Chapter 2 Introduction To Python Quiz 9 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books