This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 33 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 33 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Write the output of the following:a=8; def abc(a):print(a); abc(7) A) Error. B) 7. C) No Output. D) 8. Show Answer Correct Answer: B) 7. 2. Code for Hello, World! A) Print Hello, World!. B) Print("Hello, World!). C) Print("Hello, World!"). D) None of the above. Show Answer Correct Answer: C) Print("Hello, World!"). 3. What will the following code return? type([1, 2, 3]) A) . B) . C) . D) . Show Answer Correct Answer: D) . 4. Suppose d = { "john" :40, "peter" :45}to delete the entry for "john" what command do we use? A) Del d( "john" :40). B) Del d[ "john" ]. C) D.delete( "john" :40). D) D.delete( "john" ). Show Answer Correct Answer: B) Del d[ "john" ]. 5. The < ..... assignment operator in pseudocode is replaced by ..... in python A) ( ). B) =. C) ==. D) < The symbol is the same. Show Answer Correct Answer: B) =. 6. What is a syntax? A) Syntaxes are not written in a code to explain inner code workings. B) The symbols used in computer programming are called syntaxes. C) The rule following which different computer programs are written. D) All are correct. Show Answer Correct Answer: D) All are correct. 7. What will the following code output? print('Hello, ' + input('Enter your name:')) A) Hello, Universe!. B) Hello, [user input]. C) Hello, name. D) Hello, World!. Show Answer Correct Answer: B) Hello, [user input]. 8. Name one popular library in Python for machine learning. A) Pandas. B) Scikit-learn. C) TensorFlow. D) NumPy. Show Answer Correct Answer: B) Scikit-learn. 9. What is one of the main reasons Python is popular among beginners? A) Its simplicity and readability. B) Its complex syntax. C) Its limited library support. D) Its high cost. Show Answer Correct Answer: A) Its simplicity and readability. 10. What is the output of:print('Hi' + 'There')? A) Hi+There. B) HiThere. C) Error. D) Hi There. Show Answer Correct Answer: B) HiThere. 11. Fungsi dalam Python ditulis menggunakan kata kunci ..... A) Func. B) Def. C) Function. D) Define. Show Answer Correct Answer: B) Def. 12. What will be the output of the following code? "'pythonprint(type(3.5)) "' A) . B) . C) . D) . Show Answer Correct Answer: A) . 13. Which of the following symbols is used to place a multiline comment? A) '' '' '' ( or ' ' ' ). B) +. C) #. D) '' ( or ' ). Show Answer Correct Answer: A) '' '' '' ( or ' ' ' ). 14. What does forward(300) do? A) Moves in the direction it is facing 300 steps. B) Moves down the screen 300 steps. C) Moves up the screen 300 steps. D) None of the above. Show Answer Correct Answer: A) Moves in the direction it is facing 300 steps. 15. How is computer science divided into strands? A) By student interest. B) By difficulty level. C) By year level. D) By topic. Show Answer Correct Answer: D) By topic. 16. What do we use to define a block of code in Python language? A) Key. B) Brackets. C) Indentation. D) None of these. Show Answer Correct Answer: C) Indentation. 17. What is the purpose of the else statement in a control structure? A) The else statement executes code when the if condition is false. B) The else statement is used to handle exceptions in code. C) The else statement always executes first in a control structure. D) The else statement is used to define a loop. Show Answer Correct Answer: A) The else statement executes code when the if condition is false. 18. You need to store GPS coordinates that should never change. Which Python data structure best fits this need? A) Tuple of floats. B) Dictionary of floats. C) Mutable set. D) List of floats. Show Answer Correct Answer: A) Tuple of floats. 19. What is Data Science? A) Extracting useful insights from data. B) Data storage technique. C) Writing programs only. D) Study of hardware. Show Answer Correct Answer: A) Extracting useful insights from data. 20. Jenis data apa yang digunakan untuk menyimpan urutan karakter di Python? A) Str. B) Char. C) List. D) Int. Show Answer Correct Answer: A) Str. 21. Which of the following is a correct way to use the 'input()' function to ask for a user's name? A) Name = input(Enter your name:). B) Name = input("Enter your name: "). C) Name = input(Enter your name). D) Name = input("Enter your name"). Show Answer Correct Answer: B) Name = input("Enter your name: "). 22. Which of the following is the correct way to call a function named 'greet'? A) Call greet(). B) Greet. C) Greet(). D) Function greet(). Show Answer Correct Answer: C) Greet(). 23. What should you do if you encounter an error message in Python? A) Check and correct the code. B) Restart the computer. C) Delete the program. D) Ignore it. Show Answer Correct Answer: A) Check and correct the code. 24. How can you add a new column to a DataFrame? A) By using the insert method with a specific index. B) By using the append method on the DataFrame. C) By merging with another DataFrame. D) By assigning a list to a new column label. Show Answer Correct Answer: D) By assigning a list to a new column label. 25. In which decade was Python conceived? A) 1970s. B) 1980s. C) 2000s. D) 1990s. Show Answer Correct Answer: B) 1980s. 26. What is the output of the following code:t=(10, 20, 30, 40, 50, 50, 70)print(t[:::]) A) (10, 20, 30, 40, 50, 50, 70). B) Error. C) (10, 20, 30, 40). D) None of the above. Show Answer Correct Answer: B) Error. 27. Which of the following is the correct way to assign the value 3.5 to a variable called 'length'? A) Length = 3.5. B) Assign length 3.5. C) 3.5 = length. D) Length == 3.5. Show Answer Correct Answer: A) Length = 3.5. 28. What is the output of:print(5 + 4 * 2) A) 18. B) 13. C) Error. D) 14. Show Answer Correct Answer: B) 13. 29. How do you create a DataFrame from a list of tuples? A) Pd.DataFrame(list of tuples, columns=['col1', 'col2']). B) Pd.DataFrame(list of tuples). C) Pd.DataFrame.create(list of tuples). D) Pd.DataFrame.from tuples(list of tuples). Show Answer Correct Answer: B) Pd.DataFrame(list of tuples). 30. Name three built-in data types in Python. A) Float. B) Tuple. C) Set. D) Int, list, dict. Show Answer Correct Answer: D) Int, list, dict. 31. How do you print the number 123 in Python? A) Print(123). B) Print("123"). C) Both A and B. D) Echo 123. Show Answer Correct Answer: C) Both A and B. 32. What does the 'circle' command do? A) Moves Tracy forward. B) Draws a circle. C) Makes Tracy turn around. D) Stops the code. Show Answer Correct Answer: B) Draws a circle. 33. What will the following code output?x = 10while x > 5:print(x)x-= 2 A) 10, 8, 6. B) 10, 8, 6, 4. C) Infinite loop. D) None. Show Answer Correct Answer: A) 10, 8, 6. 34. What is the output of the expression 'Hello' + ' World'? A) Hello + World. B) Error. C) Hello World. D) HelloWorld. Show Answer Correct Answer: C) Hello World. 35. Extra programs for a language that other people can use are called A) Schools. B) Stations. C) Libraries. D) None of the above. Show Answer Correct Answer: C) Libraries. 36. Why should you NOT write print("place ..... of ..... birth") when you want the value? A) Quotes make Python treat it as text, so it prints the name not the value. B) It turns the value into a number. C) It deletes the variable. D) It will crash the computer. Show Answer Correct Answer: A) Quotes make Python treat it as text, so it prints the name not the value. 37. Which of the following statements will cause an error in Python? A) Print("Hello"). B) Print("Hello" + "World"). C) Print(Hello). D) Print('Hello'). Show Answer Correct Answer: C) Print(Hello). 38. Which of the following is a correct way to iterate over a list using a for loop? A) 'for i in list.range():'. B) 'for i in list:'. C) 'for i in range(len(list)):'. D) 'for i in 0 to len(list):'. Show Answer Correct Answer: B) 'for i in list:'. 39. Which of the following is used to check if '5' is in the list 'numbers'? A) Numbers.has(5). B) 5 in numbers. C) 5 == numbers. D) Numbers.contains(5). Show Answer Correct Answer: B) 5 in numbers. 40. How do you close a file in Python? A) .write(). B) .writelines(). C) .close(). D) .readline(). Show Answer Correct Answer: C) .close(). 41. When creating a rectangle with the turtle, what angle is needed when turning? A) 120. B) 90. C) 180. D) 45. Show Answer Correct Answer: B) 90. 42. When you run this program what will this line of code do?name = input("Enter your name: ") A) Ask you to Enter your name and save your answer to Google Drive. B) Ask you to Enter your name and save your answer to My Documents. C) Ask you to Enter your name. D) Ask you to Enter your name and save your answer as a variable. Show Answer Correct Answer: D) Ask you to Enter your name and save your answer as a variable. 43. Which of these would work as a piece of code? A) If string="Dove". B) IF string="Dove":. C) If string=="Dove". D) If string=="Dove":. Show Answer Correct Answer: D) If string=="Dove":. 44. X=6y=4print(x, y) A) 4, 6. B) 4 6. C) 6, 4. D) 6 4. Show Answer Correct Answer: D) 6 4. 45. Which of the options is not an example of a text-based programming language? A) Java. B) Blockly. C) Swift. D) Python. Show Answer Correct Answer: B) Blockly. 46. Which one is the correct assigning of value 100 to the variable x A) X <-100. B) X = 100. C) X:=100. D) X << 100. Show Answer Correct Answer: B) X = 100. 47. Which operator is used for string concatenation in Python? A) *. B) +. C) . D) &. Show Answer Correct Answer: B) +. 48. How do you create an empty dictionary in Python? A) {}. B) "". C) []. D) (). Show Answer Correct Answer: A) {}. 49. What does the subprogram turtle.setposition(x, y) do? A) Positions the turtle at specific coordinates. B) Fills the shape with a color. C) Resets the drawing canvas. D) Turns the turtle to a specific angle. Show Answer Correct Answer: A) Positions the turtle at specific coordinates. 50. Which of the following is the correct way to print a string in Python? A) System.out.println('Hello World'). B) Print("Hello World"). C) Print 'Hello World'. D) Echo 'Hello World'. Show Answer Correct Answer: B) Print("Hello World"). 51. Features of Python A) Easy to learn and read. B) Portable. C) GUI programming. D) All of the above. Show Answer Correct Answer: D) All of the above. 52. An algorithm can be best described as: A) A data storage method. B) A computer program. C) A sequence of steps to solve a problem. D) A representation of symbols. Show Answer Correct Answer: C) A sequence of steps to solve a problem. 53. Which generation of computers started using Integrated Circuit based hardware? A) Third Generation. B) First Generation. C) Fourth Generation. D) Second Generation. Show Answer Correct Answer: A) Third Generation. 54. What does the percentage sign-%-do in Python? A) Normal division. B) Addition. C) Rounding-down division. D) Gives the remainder of a division between two values. Show Answer Correct Answer: D) Gives the remainder of a division between two values. 55. To display the following on screenHello World!the following command should be used: A) Print("Hello World" + !). B) Print"(Hello World!)". C) Print(Hello World!). D) Print("Hello World!"). Show Answer Correct Answer: D) Print("Hello World!"). 56. X = 10print(type(x)) A) Str. B) Float. C) Bool. D) Int. Show Answer Correct Answer: D) Int. 57. Str1="6/4"print("str1") A) 1.5. B) 6/4. C) 1. D) Str1. Show Answer Correct Answer: D) Str1. 58. What is a global variable? A) A variable that can only be accessed within a function. B) A variable that is accessible throughout the program. C) A variable that holds multiple values. D) A variable that is defined in a class. Show Answer Correct Answer: B) A variable that is accessible throughout the program. 59. What is the result of the following operation?print(7 % 3) A) 3. B) 4. C) 2. D) 1. Show Answer Correct Answer: D) 1. 60. Which statement is adding remainder of 8 divided by 3 to the product of 5 and 6? A) 8 // 3 + 6.5. B) 8/3 + 5 * 6. C) None of the above. D) 8 % 3 + 5 * 6. Show Answer Correct Answer: D) 8 % 3 + 5 * 6. ← 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