This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 9 Practical Work Python Exercises – Quiz 10 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 10 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which operator is used to multiply numbers? A) %. B) #. C) X. D) *. Show Answer Correct Answer: D) *. 2. Look at the following code:age = "23"age = int(age)What does the int() function do to the data in my variable? A) Does nothing. B) Changes the string to an integer. C) Changes the string to a float. D) Changes the number to a string. Show Answer Correct Answer: B) Changes the string to an integer. 3. What is the output of the following python code?x=100def f1():global x x=90def f2():global x x=80print(x) A) 90. B) Error. C) 100. D) 80. Show Answer Correct Answer: C) 100. 4. What is displayed to the screen when the following code runs? esports = ["Donkey Kong", "Galaga", "Pac Man"] esports.reverse() print(esports) A) ['Donkey Kong', 'Galaga', 'Pac Man']. B) Error; you cannot use the reverse() function on a list. C) ['gnoK yeknoD', 'agalaG', naM caP']. D) ['Pac Man', 'Galaga', 'Donkey Kong']. Show Answer Correct Answer: D) ['Pac Man', 'Galaga', 'Donkey Kong']. 5. What will be the output of below Python code?list1=[8, 0, 9, 5]print(list1[::-1]) A) [8, 0, 9]. B) [5, 9, 0, 8]. C) [8, 0, 9, 5]. D) [0, 9, 5]. Show Answer Correct Answer: B) [5, 9, 0, 8]. 6. Koju verziju pythona koristimo? A) 2. B) 3. C) 1. D) 4. Show Answer Correct Answer: B) 3. 7. Carrying out instructions is known as A) Processing. B) Storage. C) Output. D) Input. Show Answer Correct Answer: A) Processing. 8. What symbol is used to multiply two numbers together? A) +. B) /. C) *. D) =. Show Answer Correct Answer: C) *. 9. Suppose a function called add() is defined in a module called adder.py. Which of the following code snippets correctly show how to import and use the add() function? Select all that apply. A) From adder import addresult = add(2, 3). B) Import addresult = adder.add(2, 3). C) Import add from adderresult = add(2, 3). D) From adder import addresult = adder.add(2, 3). Show Answer Correct Answer: A) From adder import addresult = add(2, 3). 10. What is one of the main challenges in studying Burmese Pythons in the wild? A) Their elusive nature makes them hard to track. B) There is too much human activity in their habitat. C) They are very aggressive towards humans. D) They are too small to be easily found. Show Answer Correct Answer: A) Their elusive nature makes them hard to track. 11. What does ..... init ..... do? A) Constructs the instance. B) Initialize the instance values. C) Calls the Super class. D) Creates a circle. Show Answer Correct Answer: B) Initialize the instance values. 12. Which of the following is NOT a Python rule for naming functions? A) Functions names can contain letters, numbers and underscores. B) Function names must be less than 32 characters. C) The first character in a function name cannot be a number. D) Function names are case-sensitive. Show Answer Correct Answer: B) Function names must be less than 32 characters. 13. Logical Operators:true if operand is false A) X and y. B) X or y. C) Not x. D) None of the above. Show Answer Correct Answer: C) Not x. 14. What code would you use to get an average of your maths and English test results? A) Average = (Maths+English)*2. B) Average = Maths+English/2. C) Average = (Maths+English)/2. D) Average = Maths+English*2. Show Answer Correct Answer: C) Average = (Maths+English)/2. 15. What is the purpose of comment lines in code? A) To make the code compile. B) To explain the code that follows it. C) To make your code longer so you get more points. D) To compliment your work so you feel better about it. Show Answer Correct Answer: B) To explain the code that follows it. 16. >>>str="computer">>> str1='science'>>> str3=str+str1>>> print(str3) A) "computer"'science'. B) Computerscience. C) "computerscience". D) 'computerscience'. Show Answer Correct Answer: B) Computerscience. 17. How are variable length arguments specified in the function heading? A) Two stars followed by a valid identifier. B) One star followed by a valid identifier. C) One underscore followed by a valid identifier. D) Two underscores followed by a valid identifier. Show Answer Correct Answer: B) One star followed by a valid identifier. 18. Print (name + '' is '' + age '' years old") This is an example of: A) Input. B) Output. C) Processing. D) Storage. Show Answer Correct Answer: A) Input. 19. What is the order of precedence in python?i) Parentheses, ii) Exponentialiii) Multiplication, iv) Divisionv) Addition, vi) Subtraction A) Ii, i, iv, iii, v, vi. B) I, ii, iii, iv, v, vi. C) I, ii, iii, iv, vi, v. D) Ii, i, iii, iv, v, vi. Show Answer Correct Answer: B) I, ii, iii, iv, v, vi. 20. What is the index of the name 'Paula' in the following list:names = ["Paul", "Phillip", "Paula", "Phillipa"] A) 2. B) 3. C) 0. D) 1. Show Answer Correct Answer: A) 2. 21. Identify the string membership operators of Python A) Between, not between. B) Like, not like. C) In, not in. D) As, not as. Show Answer Correct Answer: C) In, not in. 22. Tracy always starts facing which direction? A) West. B) East. C) South. D) North. Show Answer Correct Answer: B) East. 23. The condition for a while loop to continue could include which of the following? A) While something equals something. B) While something is greater than something. C) While something is True. D) All of these. Show Answer Correct Answer: D) All of these. 24. List1 = ["hello", "hey", "hi"]print(list1)How many items will be printed? A) 0. B) 1. C) 3. D) 2. Show Answer Correct Answer: C) 3. 25. What will be the output shape of the following Python code?import turtlet=turtle.Pen()for i in range(1, 4):t.forward(60)t.left(90) A) Triangle. B) Trapezium. C) Rectangle. D) Square. Show Answer Correct Answer: D) Square. 26. Select the correct operator for Exponentiation: A) )). B) XX. C) **. D) ==. Show Answer Correct Answer: C) **. 27. What is the output of the following code?for i in range(5, 0, -1):print(i) A) 432 1. B) 1234. C) 54321. D) 12345. Show Answer Correct Answer: C) 54321. 28. Why is using lists beneficial? A) More Accurate. B) It takes less time for the program to run. C) Its not beneficial. D) Shorter Code. Show Answer Correct Answer: D) Shorter Code. 29. What is the output of the following code?salary = 8000def printSalary():salary = 12000print("Salary:", salary)printSalary()print("Salary:", salary) A) Salary:12000 Salary:8000. B) Salary:8000 Salary:12000. C) The program failed with errors. D) None of the above. Show Answer Correct Answer: A) Salary:12000 Salary:8000. 30. Numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]Which of the following code will give the output as[4, 6, 8] A) [numbers[i] for i in [3, 5, 7]]. B) Numbers[4, 6, 8]. C) Numbers[3, 5, 7]. D) None of the above. Show Answer Correct Answer: A) [numbers[i] for i in [3, 5, 7]]. 31. In programming, what is iteration/looping? A) The repetition of steps within a program. B) The order in which instructions are carried out. C) A decision point in a program. D) None of the above. Show Answer Correct Answer: A) The repetition of steps within a program. 32. What symbol do you type in to add a short comment? A) @. B) """. C) #. D) /. Show Answer Correct Answer: C) #. 33. What will be the output of the following code?def max(a, b):if a > b:print('a is the max')else:print('b is the max')max(1, 2) A) A is the max. B) B is the max. C) 1 is the max. D) 2 is the max. Show Answer Correct Answer: B) B is the max. 34. Which of the following operator is valid in Lists? A) +. B) **. C) -. D) /. Show Answer Correct Answer: A) +. 35. What computer science concept does something different depending on the situation? A) Function. B) Loop. C) Variable. D) Conditional. Show Answer Correct Answer: D) Conditional. 36. Which of the following types of computer languages uses binary code to communicate with the computer? A) High-level languages. B) Database languages. C) Assembly languages. D) Machine language. Show Answer Correct Answer: D) Machine language. 37. A:Strings can be changed during executionB. Strings can be enclosed within single, double or even triple quotesC. Strings are immutable A) A, B are True but C is False. B) A, C are True but B is False. C) A, B & C are True. D) B, C are True but A is False. Show Answer Correct Answer: D) B, C are True but A is False. 38. What will:answer = input("Give me a number")print(answer * 5)output? A) Answer * 5. B) The value of answer multiplied by 5. C) An error message. D) The value of answer repeated 5 times. Show Answer Correct Answer: D) The value of answer repeated 5 times. 39. Which method is used to add a value at a specified position in the list? A) Insert. B) Append. C) Extend. D) Pop. Show Answer Correct Answer: A) Insert. 40. The output of the following code is# program for addition of 2 numbersa = 10b = 3c = a + bprint("the sum is ", c) A) 7. B) 3. C) 13. D) 10. Show Answer Correct Answer: C) 13. 41. Which function accepts all data as string or characters but not as numbers? A) Output(). B) Int(). C) Print(). D) Input(). Show Answer Correct Answer: D) Input(). 42. What are class variables? A) Variables with a sense of style. B) Variables that apply to all instances of the class. C) Variables that change with every instance of the class. D) Integers. Show Answer Correct Answer: B) Variables that apply to all instances of the class. 43. Which character represents a comment in Python code? A) &. B) $. C) #. D) *. Show Answer Correct Answer: C) #. 44. ..... statement can also be used without specifying Exception. A) Try. B) Finally. C) Except. D) Else. Show Answer Correct Answer: C) Except. 45. How would we round the variable hourspermonth to 2 decimal places A) Hourspermonth = round/2(hourspermonth). B) Hourspermonth = round (hourspermonth, 2). C) Hourspermonth = round (hourspermonth, 2. D) Hourspermonth = round(hourspermonth). Show Answer Correct Answer: B) Hourspermonth = round (hourspermonth, 2). 46. Lists are used to store single item in a single variable. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 47. A command that lets us repeat an action multiple times in your code A) Variable. B) Algorithm. C) Loop. D) Method. Show Answer Correct Answer: C) Loop. 48. What is the syntax for creating a list in Python? A) My list = [1 2 3 4 5]. B) My list = (1, 2, 3, 4, 5). C) My list = {1, 2, 3, 4, 5}. D) My list = [1, 2, 3, 4, 5]. Show Answer Correct Answer: D) My list = [1, 2, 3, 4, 5]. 49. The expression int(x) implies that the variable x is converted to integer. State whether true or false. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 50. Bundling two values together into one can be considered as A) Pair. B) Single. C) Quadrat. D) Triplet. Show Answer Correct Answer: A) Pair. 51. Which method is used to merge two lists? A) Merge. B) Join. C) Append. D) Extend. Show Answer Correct Answer: D) Extend. 52. What data type would store the value:Oranges A) String. B) Boolean. C) Integer. D) Float. Show Answer Correct Answer: A) String. 53. Numbers = [1, 3, 2, 4, 5]Which of the following code can output a sorted list without actually sorting the original list A) Numbers.sort(). B) Sort(numbers). C) Numbers.sorted(). D) Sorted(numbers). Show Answer Correct Answer: D) Sorted(numbers). 54. What will be the output of the following code snippet? name1 = "jazz"name 2 = "madonna"if name1 != name2:print("No")else:print("Yes") A) Yes. B) Madonna. C) Compilation Error. D) No. Show Answer Correct Answer: D) No. 55. What is the output from the following code?print ("hello world") A) Hello World. B) Hello world. C) Print hello world. D) None of the above. Show Answer Correct Answer: B) Hello world. 56. Select the correct Operator for addition A) +. B) =. C) X. D) $. Show Answer Correct Answer: A) +. 57. Predict output for the following code snippet.print('No pain, no gain'.split('a')) A) ['No pain', ' no gain']. B) ['No pai', ', ', 'o gai', '']. C) ['No', 'pain, ', 'no', 'gain']. D) ['No p', 'in, no g', 'in']. Show Answer Correct Answer: D) ['No p', 'in, no g', 'in']. 58. What is the average value of the code that is executed below?>>>grade1 = 80>>>grade2 = 90>>>average = (grade1 + grade2) / 2 A) 85.0. B) 85. C) 90.0. D) 85.1. Show Answer Correct Answer: A) 85.0. 59. Look at the following code:age = 23age = age * 2print (age)What is printed? A) 23. B) 25. C) 23 * 2. D) 46. Show Answer Correct Answer: D) 46. 60. Anil is writing a "rock, scissors, paper" program. He wants the game to repeat until the user doesn't want to play anymore. What loop should he use? A) A FOR loop. B) A WHILE loop. C) All the above. D) None of the above. Show Answer Correct Answer: B) A WHILE loop. ← PreviousNext →Related QuizzesScience QuizzesClass 11 QuizzesClass 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 1Class 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 2Class 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 3Class 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 4Class 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 5Class 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 6Class 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 7Class 11 Computer Science Chapter 9 Practical Work Python Exercises Quiz 8 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books