This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 21 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 21 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Strings must always be written inside quotation marks in Python. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 2. A student wants the output to be Aisha Khan. Which line should they use? A) Print(first name + last name + '' "). B) Print(first name + last name + "."). C) Print(" '' + first name + last name). D) Print(first name + '' '' + last name). Show Answer Correct Answer: D) Print(first name + '' '' + last name). 3. What will happen if you tell Tracy 'forward 50' and run the code? A) Tracy moves 100 pixels. B) Tracy moves 50 pixels. C) Tracy draws a circle. D) Tracy gives an error. Show Answer Correct Answer: D) Tracy gives an error. 4. What is the function of syntax error? A) It will not display error message in the line of code. B) It will display error and rectify. C) It will display error message in the line of code. D) It will display no error message in the line of code. Show Answer Correct Answer: C) It will display error message in the line of code. 5. What is the result of the following code? "'pythonweight = 12.5print(type(weight)) "' A) ". B) ". C) ". D) ". Show Answer Correct Answer: A) ". 6. What data type will the variable 'age' have after executing the following code?age = input("Enter your age: ") A) Float. B) Int. C) Bool. D) Str. Show Answer Correct Answer: D) Str. 7. What is the first step to execute Python code? A) Run the code in a browser. B) Install Python. C) Compile the code. D) Write code in a text editor. Show Answer Correct Answer: B) Install Python. 8. In PLS, which of the following is NOT a primitive data type? A) String. B) Real. C) Integer. D) Boolean. Show Answer Correct Answer: A) String. 9. TRUE or FALSE:Python is named after a snake. A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: B) FALSE. 10. What should you do if you want to output the lines of your favorite song in Python? A) Use the 'show' command. B) Use the 'print' command. C) Use the 'display' command. D) Use the 'echo' command. Show Answer Correct Answer: B) Use the 'print' command. 11. What will be the output of this code?for i in range(5):if i == 3:breakprint(i) A) 0 1 2 4 5. B) 0 1 2 4. C) 0 1 2 3 4. D) 0 1 2. Show Answer Correct Answer: D) 0 1 2. 12. What is the first step in the Green Screen effect? A) Tell the computer to look at each pixel. B) Identify the foreground object. C) Change the color of the pixels. D) Get the background image. Show Answer Correct Answer: A) Tell the computer to look at each pixel. 13. Which of the following is the final step in program development? A) Writing the code. B) Problem analysis. C) Maintenance. D) Debugging. Show Answer Correct Answer: C) Maintenance. 14. Fungsi lambda pada Python disebut juga ..... A) Anonymous function. B) Static function. C) Named function. D) Default function. Show Answer Correct Answer: A) Anonymous function. 15. How to find the length of a list in python? A) A.len(). B) A.length(). C) Length(a). D) Len(a). Show Answer Correct Answer: D) Len(a). 16. Consider nums = (5, 3, 5). After calling sorted(nums), which statement about the result is correct? A) It modifies nums into [3, 5, 5]. B) It returns a new list [3, 5, 5]. C) It modifies nums into (3, 5, 5). D) It returns a new tuple (3, 5, 5). Show Answer Correct Answer: B) It returns a new list [3, 5, 5]. 17. What is the primary purpose of an Integrated Development Environment (IDE)? A) To compile code. B) To run code in the cloud. C) To provide comprehensive facilities for software development. D) To manage databases. Show Answer Correct Answer: C) To provide comprehensive facilities for software development. 18. To print a list called fruitList we use A) Print(fruitList). B) FruitList.print(). C) FruitList(print). D) List(print). Show Answer Correct Answer: A) Print(fruitList). 19. Fungsi apa yang digunakan untuk menampilkan output ke layar dalam Python? A) Input(). B) Print(). C) Type(). D) Len(). Show Answer Correct Answer: B) Print(). 20. What type of data does input() return? A) Boolean. B) Integer. C) String. D) Float. Show Answer Correct Answer: C) String. 21. Which of the following is NOT a valid way to assign a value to a variable in Python? A) Temp = 15.5. B) Name = "Sam". C) 7 = x. D) X = 7. Show Answer Correct Answer: C) 7 = x. 22. How do you make a comment in Python? A) . B) #. C) //. D) !!. Show Answer Correct Answer: B) #. 23. What will be the output of the following code? x = "10" y = 5 print(x + str(y)) A) 105. B) Error. C) 10 5. D) 15. Show Answer Correct Answer: A) 105. 24. You have place ..... of ..... birth = "Middlesbrough" . Which line will produce a neat sentence? A) Print("You were born in" = place of birth). B) Print("You were born in" + place of birth). C) Print("You were born in" place of birth). D) Print("You were born in '' + place of birth). Show Answer Correct Answer: D) Print("You were born in '' + place of birth). 25. How to manipulate tuples? A) A(50) = 75. B) A = (75). C) We can't manipulate tuples in python. D) A[0] = (90). Show Answer Correct Answer: C) We can't manipulate tuples in python. 26. A collection of stored Python functions is called a- A) Package. B) Module. C) Library. D) Framework. Show Answer Correct Answer: C) Library. 27. What is the extension for a Python file? A) .doc. B) .java. C) .py. D) .txt. Show Answer Correct Answer: C) .py. 28. Which of the following lines of code will correctly store the number 25 as an integer in a variable called 'age'? A) Int age = 25. B) Age = 25.0. C) Age = int("25"). D) Age = "25". Show Answer Correct Answer: C) Age = int("25"). 29. How could we represent/describe the process of a computer making a decision in a program? A) IF-THEN-ELSE. B) IF-OTHERWISE. C) WHEN-DO. D) None of the above. Show Answer Correct Answer: A) IF-THEN-ELSE. 30. What is a for loop? A) A definite loop that specifies actions on a list of items. B) A type of variable. C) An error in the program. D) None of the above. Show Answer Correct Answer: A) A definite loop that specifies actions on a list of items. 31. The datatype of a variable can be found by using the following function: A) Datatype(). B) Type(). C) Dt(). D) Dtype(). Show Answer Correct Answer: B) Type(). 32. Which is used to end an if statement block? A) Stop. B) End. C) Done. D) Indentation. Show Answer Correct Answer: D) Indentation. 33. Explain what a function is in Python. A) A function in Python is a built-in method that automatically executes on program start. B) A function in Python is a defined block of code that performs a specific task, can take inputs, and may return an output. C) A function in Python is a variable that stores data and cannot perform actions. D) A function in Python is a type of loop that iterates over a sequence of values. Show Answer Correct Answer: B) A function in Python is a defined block of code that performs a specific task, can take inputs, and may return an output. 34. Which function is used to take input from a user? A) Type(). B) Scan(). C) Read(). D) Input(). Show Answer Correct Answer: D) Input(). 35. "and, or and not" are ..... A) Arithmetic operator. B) Assignment operator. C) Logical operators. D) Comparative operator. Show Answer Correct Answer: C) Logical operators. 36. Extension file in python is A) .py. B) .pyt. C) .python. D) .ppyt. Show Answer Correct Answer: A) .py. 37. What method in Python is used to add an element to the end of a list? A) Extend( ). B) Insert( ). C) Push( ). D) Append( ). Show Answer Correct Answer: D) Append( ). 38. Write the output of the following code:x=2; x=5; x=x+x; print(x) A) 10. B) 4. C) 7. D) Error. Show Answer Correct Answer: A) 10. 39. Why is it important for students like Sebastian, Anaya, and Ella to learn computer science in school? A) To give them important skills for the future. B) To prepare them for GCSE and A level computer science. C) To teach them about algorithms and programming. D) To provide a solid foundation of knowledge. Show Answer Correct Answer: A) To give them important skills for the future. 40. Which of the following tasks should a program perform based on the given requirements? (a) Generate a Fibonacci sequence of length N. (b) Calculate factorial and binomial coefficient using N and R. A) Generate a Fibonacci sequence of length N and calculate factorial and binomial coefficient using N and R. B) Sort an array and find its median. C) Calculate the sum and average of N numbers. D) Generate random numbers and display their squares. Show Answer Correct Answer: A) Generate a Fibonacci sequence of length N and calculate factorial and binomial coefficient using N and R. 41. What does print('a' in 'cat') output? A) 'a'. B) Error. C) False. D) True. Show Answer Correct Answer: D) True. 42. What is the output of the following code? print( 100/5) A) 25. B) 20. C) 15. D) 22. Show Answer Correct Answer: B) 20. 43. What is the name of the Python environment that allows you to write your program and then test them out? A) IDLE. B) Window. C) Shell. D) CLI. Show Answer Correct Answer: A) IDLE. 44. In a flowchart, parallelogram is used to represent ..... A) Start and end point. B) Process. C) Input and output. D) Decision. Show Answer Correct Answer: C) Input and output. 45. What is the output of the following code?x = 3while x > 0:x-= 1print(x) A) 2, 1. B) 3, 2, 1. C) 1, 0. D) 2, 1, 0. Show Answer Correct Answer: D) 2, 1, 0. 46. What is the output of print('Age:', age) if age = 25? A) Age:25. B) Age:. C) 25. D) None of the above. Show Answer Correct Answer: A) Age:25. 47. Which one of these is floor division? A) //. B) /. C) %. D) None of the above. Show Answer Correct Answer: A) //. 48. How do you print "Hello, World!" in Python? A) Display("Hello, World!"). B) Print("Hello, World!"). C) Text("Hello, World!"). D) Show("Hello, World!"). Show Answer Correct Answer: B) Print("Hello, World!"). 49. What is the result of the following expression:$4 * (2 + 3)$ A) 12. B) 9. C) 14. D) 20. Show Answer Correct Answer: D) 20. 50. Python is known as ..... A) Excel. B) Integrated Development Environment. C) IDLE. D) Office. Show Answer Correct Answer: B) Integrated Development Environment. 51. How do you create a variable with the floating number 2.8? A) X=1.2. B) X=float(1.2). C) Both r correct. D) None of the above. Show Answer Correct Answer: C) Both r correct. 52. What is the role of a Python interpreter? A) To translate and execute Python programs. B) To display messages. C) To assign values to variables. D) To receive keyboard input. Show Answer Correct Answer: A) To translate and execute Python programs. 53. What will the following code output if the user inputs "Alice" ? 'name = input("Enter your name: ")' 'print("Hello '' + name)' A) Hello name. B) Hello Alice. C) Hello "Alice". D) Error. Show Answer Correct Answer: B) Hello Alice. 54. Which of the following correctly accesses value 85 from a dictionary d = {"marks":85}? A) D["marks"]. B) D(marks). C) D{marks}. D) D[0]. Show Answer Correct Answer: A) D["marks"]. 55. What is the purpose of indentation in Python? A) Specifies the scope of different chunks of code. B) To make the code look pretty. C) To create variables. D) None of the above. Show Answer Correct Answer: A) Specifies the scope of different chunks of code. 56. Tahap data cleansing berarti ..... A) Menghapus data penting. B) Membersihkan data dari ketidakkonsistenan. C) Menambahkan noise pada data. D) Menggabungkan data dari sumber berbeda. Show Answer Correct Answer: B) Membersihkan data dari ketidakkonsistenan. 57. What does 'len()' return? A) Area. B) Width. C) Height. D) Length. Show Answer Correct Answer: D) Length. 58. What is the result of 'math.sqrt(x)'? A) The largest integer not greater than x. B) The smallest integer not less than x. C) The square root of the value x. D) The constant Pi. Show Answer Correct Answer: C) The square root of the value x. 59. What is a nested loop? Provide an example. A) Example of a nested loop in Python:for i in range(3):for j in range(2):print(i, j). B) A loop that runs only once. C) A loop that iterates over a single list. D) A loop that does not contain any other loops. Show Answer Correct Answer: A) Example of a nested loop in Python:for i in range(3):for j in range(2):print(i, j). 60. Which of the following is a valid way to create a set in Python? A) Set = set(). B) Set = []. C) Set = (). D) Set = {}. Show Answer Correct Answer: A) Set = set(). ← 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