This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 8 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 8 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the output of the following code when coin is 0?from random import randintcoin = randint(0, 1)if coin == 0:result = "heads" print(result)else:result = "tails" A) "tails". B) "Either heads or tails". C) "heads". D) "Either heads or nothing". Show Answer Correct Answer: C) "heads". 2. What kind of statements does Python use in its code lines? A) Machine language statements. B) Symbolic statements. C) English-like statements. D) Binary code statements. Show Answer Correct Answer: C) English-like statements. 3. If you want more than one option for your code, what do you use (after if)? A) Elif. B) Else. C) Ifif. D) None of the above. Show Answer Correct Answer: A) Elif. 4. Which of the following statements is true about Python? A) Python is a paid programming language. B) Python is a low-level programming language. C) Python uses English-like statements that are easy to understand. D) Python cannot be used for communication with computers. Show Answer Correct Answer: C) Python uses English-like statements that are easy to understand. 5. What is the purpose of the 'else' statement in a conditional? A) The 'else' statement is used to define a new function. B) The 'else' statement is optional and has no effect on the code. C) The 'else' statement is only used in loops. D) The 'else' statement defines what to do when the 'if' condition is false. Show Answer Correct Answer: D) The 'else' statement defines what to do when the 'if' condition is false. 6. If a={5, 6, 7}, what happens when a.add(5) is executed? A) Error as there is no add function for set data type. B) A={5, 5, 6, 7}. C) Error as 5 already exists in the set. D) A={5, 6, 7}. Show Answer Correct Answer: D) A={5, 6, 7}. 7. What is the first program you should create in a new programming language? A) Print 'Hello world!'. B) Print 'Goodbye world!'. C) Print 'Hello Python!'. D) None of the above. Show Answer Correct Answer: A) Print 'Hello world!'. 8. What is the output of the following code? "'pythonprint("Python" + "3") "' A) Python, 3. B) Python3. C) Python+3. D) Python 3. Show Answer Correct Answer: B) Python3. 9. A step by step set of instructions used to solve a problem A) Algorithm. B) Function. C) Variable. D) None of the above. Show Answer Correct Answer: A) Algorithm. 10. What is the output of the below code?num ..... list = [10.5, 30.5, -1.20, 10.10]num ..... list.insert(-3, -10.5)num ..... list.pop(0)print(num ..... list[0]) A) -10.5. B) 10.1. C) -1.2. D) 30.5. Show Answer Correct Answer: A) -10.5. 11. X=6y=7X=4, 8print(x, y) A) (4, 8) 7. B) (4, 8), 7. C) (4, 8) 7. D) (4 8) 7. Show Answer Correct Answer: D) (4 8) 7. 12. Python is an example of a: A) Text-based programming language. B) Block-based programming language. C) Visual-based programming language. D) Language written in JavaScript. Show Answer Correct Answer: A) Text-based programming language. 13. Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation? A) Print(list1[2:]). B) Print(list1[:2]). C) Print(list1[:-2]). D) All of the mentioned. Show Answer Correct Answer: D) All of the mentioned. 14. In python, decimal numbers are called A) Float. B) Floater. C) Bubbles. D) Balloon. Show Answer Correct Answer: A) Float. 15. Given t = (4, 2, 7, 2). Which statement correctly describes applying sorted(t)? A) Returns a tuple removing duplicates. B) Returns a list ordered ascending. C) Returns a tuple ordered ascending. D) Returns a list preserving original order. Show Answer Correct Answer: B) Returns a list ordered ascending. 16. How can you take an integer input from the user? A) X = int(input("Enter a number: ")). B) X = str(input("Enter a number: ")). C) X = input("Enter a number: "). D) X = float(input("Enter a number: ")). Show Answer Correct Answer: A) X = int(input("Enter a number: ")). 17. What is the difference between a list and a tuple in Python? A) Lists can contain only numbers; tuples can contain any data type. B) Lists are faster than tuples in all cases. C) Lists are mutable; tuples are immutable. D) Tuples are mutable; lists are immutable. Show Answer Correct Answer: C) Lists are mutable; tuples are immutable. 18. A ..... is the smallest element of a python script that is meaningful to the interpreter? A) NUMERIC. B) String. C) I. Boolean. D) TOKEN. Show Answer Correct Answer: D) TOKEN. 19. What is the PLS equivalent for the data type 'integer'? A) Str. B) Bool. C) Float. D) Int. Show Answer Correct Answer: D) Int. 20. 'If' is a decision making statement A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: A) TRUE. 21. Who developed Python? A) Bjarne Stroustrup. B) Dennis Ritchie. C) James Gosling. D) Guido Van Rossum. Show Answer Correct Answer: D) Guido Van Rossum. 22. Which operator performs a multiplication? A) +. B) X. C) /. D) *. Show Answer Correct Answer: D) *. 23. What is the result of 3 + 5? A) 35. B) 53. C) Error. D) 8. Show Answer Correct Answer: D) 8. 24. Optional or default parameters in functions can be defined with: A) Keyword arguments. B) Default arguments. C) Optional arguments. D) Boolean arguments. Show Answer Correct Answer: A) Keyword arguments. 25. How do you create a new variable in Python? A) Score = 0. B) Var score = 0. C) Let score = 0. D) Int score = 0. Show Answer Correct Answer: A) Score = 0. 26. What is the result of the expression 5 + 3 * 2? A) 10. B) 13. C) 11. D) 16. Show Answer Correct Answer: C) 11. 27. Which of the following is not a use and application of Python? A) Research. B) Software Development. C) AI and Machine Learning. D) Internet of Things. Show Answer Correct Answer: B) Software Development. 28. Which of the following translators do not produce an object file? A) Compiler. B) Interpreter. C) Assembler. D) None of the above. Show Answer Correct Answer: B) Interpreter. 29. Which one is a list? A) <1, 2>. B) (1, 2). C) {1, 2}. D) [1, 2]. Show Answer Correct Answer: D) [1, 2]. 30. What is the result of 'type("Hello")' in Python? A) . B) . C) . D) . Show Answer Correct Answer: A) . 31. What is the output of the following code:print(int(3.14))? A) 3.1. B) 3. C) 3.14. D) 3.4. Show Answer Correct Answer: C) 3.14. 32. What is the purpose of tracing variables in a program? A) To translate programming languages. B) To execute instructions. C) To track the values of variables. D) To display messages. Show Answer Correct Answer: C) To track the values of variables. 33. Which of the following statements will print the data type of the variable 'a'? A) Print(type(a)). B) Print(datatype(a)). C) Print(typeOf(a)). D) Print(typeof(a)). Show Answer Correct Answer: A) Print(type(a)). 34. Which of the following is a feature of Python? A) Dynamic semantics. B) Low-level data structures. C) Static typing. D) No support for modules. Show Answer Correct Answer: A) Dynamic semantics. 35. What is the correct way to start a while loop? A) Repeat (condition) until;. B) Do { while (condition); }. C) While (condition) {. D) For (condition) {. Show Answer Correct Answer: C) While (condition) {. 36. What will print(type(age)) return if age = 25? A) Int. B) Str. C) Float. D) None of the above. Show Answer Correct Answer: A) Int. 37. What does a Python program do? A) Bakes cookies. B) Writes books. C) Tells the computer what to do. D) Makes drawings. Show Answer Correct Answer: C) Tells the computer what to do. 38. What is the name of the binary code (0s and 1s) that a CPU directly understands? A) Assembly Language. B) English. C) Machine Language. D) Python Code. Show Answer Correct Answer: C) Machine Language. 39. What is the difference between 'break' and 'continue' statements? A) 'break' skips to the next iteration; 'continue' exits a loop. B) 'break' exits a loop; 'continue' skips to the next iteration. C) 'break' can only be used in functions; 'continue' can be used anywhere. D) 'break' and 'continue' are interchangeable in loops. Show Answer Correct Answer: B) 'break' exits a loop; 'continue' skips to the next iteration. 40. Which one of these is a loop in Python? A) Def. B) While. C) Elif. D) If. Show Answer Correct Answer: B) While. 41. Which of the following is a valid for loop in Python? A) For i in range(0, 5):. B) For(i=0; i < n; i++). C) For i in range(5). D) For i in range(0, 5). Show Answer Correct Answer: A) For i in range(0, 5):. 42. What is Python known for? A) Readability. B) Security. C) Speed. D) Complexity. Show Answer Correct Answer: A) Readability. 43. Which of the following is a valid data type in Python? A) 'integer'. B) 'decimal'. C) 'character'. D) 'string'. Show Answer Correct Answer: D) 'string'. 44. Str1="poWer"str1.upper()print(str1) A) Power. B) POWER. C) Power. D) PoWer. Show Answer Correct Answer: D) PoWer. 45. Which of the below operators can be used to compare two numbers A) ==. B) /. C) =. D) None of the above. Show Answer Correct Answer: A) ==. 46. What is a list in Python? A) A list in Python is a mutable, ordered collection of items defined by square brackets. B) A list in Python is a fixed-size array of integers. C) A list in Python is an immutable collection of items. D) A list in Python is a collection of items defined by curly braces. Show Answer Correct Answer: A) A list in Python is a mutable, ordered collection of items defined by square brackets. 47. What data type is the value 'True' in Python? A) String. B) Boolean. C) Float. D) Integer. Show Answer Correct Answer: B) Boolean. 48. What is the process illustrated in the course objectives? A) Building mobile apps. B) Creating web pages. C) Designing graphics. D) Structuring the data using lists, tuples. Show Answer Correct Answer: D) Structuring the data using lists, tuples. 49. What must you do to correctly communicate a command to Tracy? A) Use uppercase letters. B) Follow specific syntax. C) Use any programming language. D) Speak loudly. Show Answer Correct Answer: B) Follow specific syntax. 50. What is the difference between a list and a tuple? A) Tuples are created using square brackets and lists with parentheses. B) Lists can contain only numbers while tuples can contain any data type. C) Both lists and tuples are mutable and can be changed after creation. D) The main difference is that lists are mutable and tuples are immutable. Show Answer Correct Answer: D) The main difference is that lists are mutable and tuples are immutable. 51. What kind of language does a computer understand? A) Hexadecimal. B) Unary. C) Decimal. D) Binary. Show Answer Correct Answer: D) Binary. 52. What is the output of the expression 'Hello' * 3? A) 3 Hello. B) Hello + Hello + Hello. C) Hello 3. D) HelloHelloHello. Show Answer Correct Answer: D) HelloHelloHello. 53. In Python single line comment starts with ..... A) #. B) /*. C) !. D) %. Show Answer Correct Answer: A) #. 54. What happens if you try to add a row with a duplicate index in a DataFrame? A) The existing row with that index will be updated. B) An error will be thrown and the row will not be added. C) The duplicate index will be ignored and a new row will be created. D) The DataFrame will automatically rename the duplicate index. Show Answer Correct Answer: A) The existing row with that index will be updated. 55. Which of the following is an interpreted language? A) C++. B) Python. C) Fortran. D) C. Show Answer Correct Answer: B) Python. 56. What is the purpose of Jython in integrating with Java? A) Jython is designed for low-level programming. B) Jython can communicate with existing Java infrastructure more effectively. C) Jython is used for developing microcontroller applications. D) Jython is a replacement for CPython in Java environments. Show Answer Correct Answer: B) Jython can communicate with existing Java infrastructure more effectively. 57. Which of the following is a valid way to import a module in Python? A) Include module name. B) Require module name. C) Import module name. D) Using module name. Show Answer Correct Answer: C) Import module name. 58. Age = '5'In the code above, age is a A) String. B) Integer. C) Floating point. D) None of the above. Show Answer Correct Answer: A) String. 59. X, y=5, 6print(x==5) A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 60. What will print('Hello') show on the screen? A) 'Hello'. B) Hello. C) Nothing. D) Hello. Show Answer Correct Answer: B) Hello. ← 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 9 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books