Ch-03: Programming Fundamentals - MCQs - PDF
Ch-03: Programming Fundamentals - MCQs - PDF
Chapter
03 Programming Fundamentals
MULTIPLE CHOICE QUESTIONS
1. A set of well-defined instructions which a computer can execute to solve a
problem is called:
a. Program b. Computer
c. Interpreter d. Programming language
2. When a computer program is executed, it is loaded into:
a. Main memory b. Processor
c. Secondary storage d. Cache memory
3. During execution of a program, the computer stores the program and data
related to the program in:
a. Main memory b. Processor
c. Secondary storage d. Printer
4. The primary reason for keeping both the program and data in main memory
during execution is:
a. To ensure data is not last b. For faster execution
c. For backup purposes d. To prevent errors
5. An interactive program typically requires:
a. User input during execution b. Constant Internet connection
c. No user interaction d. Running the background
6. Which program type typically requires the user to enter data while it’s
running?
a. Interactive program b. Batch program
c. Both require user input d. Neither require user input
7. Which of the following is an example of an interactive program?
a. Chat Applications b. Web browser
c. Video games d. All of Above
1|P age
Computer Science Class-11
2|P age
Computer Science Class-11
3|P age
Computer Science Class-11
4|P age
Computer Science Class-11
33. Which of the following is an online IDE for writing and executing code?
a. Replit b. PyCharm
c. Visual Studio d. Eclipse
34. IDLE stands for:
a. Interactive Data Language Explorer
b. Integrated Development and Learning Engine
c. Integrated Development and Learning Environment
d. Interactive Debugging and Learning Environment
35. The prompt that indicates that Python shell is ready to accept commands is:
a. >> b. >>>
c. # d. $
36. What is Replit?
a. Online IDE b. Programming language
c. Python library d. Website
37. The primary function of Replit is:
a. Play video games b. Write and execute code
c. Create social media posts d. Send emails
38. The extension for Python files is:
a. .pi b. .py
c. .python d. .p
39. A ______ is a name that refers to a value in the computer’s memory.
a. Variable b. Register
c. RAM d. Byte
40. Variable names cannot begin with:
a. Number b. Underscore
c. Upper-case letter d. Lower-case letter
5|P age
Computer Science Class-11
6|P age
Computer Science Class-11
50. Which of the following is the simplest method to find a logical bug?
a. Dry Running the code b. Rewriting the entire code
c. Compiling the entire code d. Checking variable names
51. Which type of errors can be most effectively identified through a dry run?
a. Syntax errors b. Runtime errors
c. Logical errors d. Compilation errors
52. The primary activity involved in a dry run is to:
a. Execute program on computer b. Execute program on paper
c. Test application’s user interface d. Automatically correct syntax errors
53. Which of the following is a valid data type in Python?
a. char b. integer
c. float d. All of above
54. What is the data type of the value 3.14?
a. char b. integer
c. float d. Boolean
55. Which data type is used to represent True or False values?
a. char b. integer
c. float d. Boolean
56. The method to assign a value of 5 to the variable x in Python is:
a. x=5 b. x==5
c. var x=5 d. (x) == 5
57. The function used to take user input as a string and store it in a variable in
Python is:
a. read() b. input()
c. get_input() d. get()
58. The input() function in Python returns:
a. integer b. string
c. Boolean d. float
7|P age
Computer Science Class-11
8|P age
Computer Science Class-11
9|P age
Computer Science Class-11
10 | P a g e
Computer Science Class-11
11 | P a g e
Computer Science Class-11
12 | P a g e
Computer Science Class-11
13 | P a g e
Computer Science Class-11
14 | P a g e
Computer Science Class-11
15 | P a g e
Computer Science Class-11
16 | P a g e
Computer Science Class-11
17 | P a g e
Computer Science Class-11
18 | P a g e
Computer Science Class-11
145. Which of the following shapes can you draw using Turtle Graphics?
a. Triangle b. Square
c. Circle d. All of above
146. The basic line drawing functions in turtle graphics are:
a. draw_line() and move_line() b. forward() and backward()
c. draw() and move() d. line_next() and line_back()
147. In Turtle graphics, what unit is used to measure distance in forward() and
backward() functions?
a. inches b. pixels
c. centimeters d. meters
148. What command is used to turn the turtle to the right in Turtle Graphics?
a. turn_right() b. right()
c. rotate_right() d. turn()
149. Which command is used to draw a circle with a specified radius in Turtle
Graphics?
a. turtle_circle() b. turtle.draw_circle()
c. tirtle.arc() d. turtle.draw()
150. Which of the following can be used to draw a circle with radius 50?
a. turtle.circle(50) b. turtle.circle(100)
c. turtle.drawcircle(50) d. turtle.drawCircle(50)
151. Which command is used to draw a simple dot in Python?
a. turtle.circle() b. turtle.dot()
c. turtle.point() d. turtle.draw()
152. Which command is used to change the turtle’s drawing color in Python?
a. turtle.penup(color) b. turtle.pendown(color)
c. turtle.pencolor(color) d. turtle.fillcolor(color)
19 | P a g e
Computer Science Class-11
20 | P a g e
Computer Science Class-11
161. Which of the following is used to format a datetime object into a string?
a. strftime() b. range()
c. len() d. randint()
162. Which of the following is the correct syntax to use strftime()?
a. datetime_strftime(format) b. strftime(datetime, format)
c. datetime_object_strftime(format) d. format.strftime(datetime_object)
163. How would you format a datetime object to show the day of the week using
strftime()?
a. %D b. %w
c. %M d. %A
164. Which format code represents name of the month in strftime()?
a. %B b. %m
c. %M d. %A
165. The format code %Y in the strftime() function represents _____ in Python.
a. Day of the month b. Month of the year
c. Year with century d. Hour (24-hour clock)
166. Which format string can be used with strftime() to display date as “Monday,
January 1, 2024”?
a. %A, %B, %d, %Y b. %S, %B %d, %Y
c. %M %d %S, %Y d. %Y, %B %A, %H
167. Which of the following statements about lists is TRUE?
a. Can only contain numbers b. Can be modified after creation
c. Cannot store duplicate elements d. Can only contain strings
168. In Python, the mutable data type among the given option is:
a. int b. float
c. tuple d. list
21 | P a g e
Computer Science Class-11
169. What is the syntax for using the Index() function in Python lists?
a. list.Index(value) b. index(list, value)
c. value.index(list) d. list.Index()
170. How does Index() function handle multiple occurrences of the specified value
in the list?
a. Returns index of last occurrence b. Returns index of first occurrence
c. Returns a list of all positions d. Returns an error
171. Suppose list1 is (3, 4, 5, 20, 5, 25, 1, 3) what is list1.Index(5)?
a. 0 b. 4
c. 1 d. 2
172. What index() returns if the specified value is not found in the list is?
a. None b. -1
c. 0 d. An error
173. How do you access the last element of a list named myList?
a. myList[0] b. myList[-1]
c. myList[len(myList)] d. myList[-2]
174. The Index number of the last element in any list with 5 elements is:
a. 5 b. 4
c. 0 d. 1
175. Supplies list1 is [1, 3, 2, 4, 5, 2, 1, 0], what is list1[-1]?
a. 3 b. 5
c. 1 d. 0
176. Which of the following is the correct way to create an empty list in Python?
a. list = {} b. list = []
c. list = [None] d. list = None
177. Which of the following is the correct way to create list in Python?
a. list1 = {} b. list1 = [12, 4, 4]
c. list1 = [1, “3”, “red”] d. All of above
22 | P a g e
Computer Science Class-11
23 | P a g e
Computer Science Class-11
185. Which of the following methods is used to add an element to the end of a list
in Python?
a. append() b. add()
c. insert() d. extend()
186. Which of the following can be used to add 5 to the end of list1?
a. list1.add(5) b. list1.append(5)
c. list1.addLast(5) d. list1.addEnd(5)
187. Which method is used to insert an element at a specific position in a list?
a. add() b. insert()
c. append() d. put()
188. Which of the following can be used to insert 5 to the third position in list1?
a. list1.insert(3, 5) b. list1.insert(2, 5)
c. list1.add(3, 5) d. list1.append(3, 5)
189. Which of the following statement about the abs() function is true?
a. it always returns a positive value b. it modifies the original number
c. it squares the value of a number d. it only works with integers
190. Which of the following is not a valid use of the abs() function in Python?
a. abs(-8) b. abs(2)
c. abs(‘pas’) d. abs(-4.5)
191. What is the output of the code? Print(abs(-2.5))
a. 2.5 b. 2
c. 5 d.
192. What will be the output of the code? Print(abs(3.5))
a. -3.5 b. 3
c. 3.5 d. 0.5
24 | P a g e
Computer Science Class-11
25 | P a g e
Computer Science Class-11
26 | P a g e
Computer Science Class-11
208. The term used to describe the value passed to a function when it is called is:
a. Parameters b. Variables
c. Arguments d. Constants
209. The arguments to function in Python always appear within:
a. Brackets b. Parentheses
c. Curly Braces d. Quotation Marks
210. How many values can be passed to the function?
a. One b. Two
c. Three d. Many
211. In Python, a function can return:
a. One value b. Two values
c. Three values d. Any number of values
212. The keyword used to specify the value returns by a function in Python is:
a. return b. call
c. output d. exit
213. A variable define inside a function is known as:
a. Local variable b. Global variable
c. Main variable d. External variable
214. A variable define outside a function is known as:
a. Local variable b. Function variables
c. Global variables d. Main variables
215. The process of finding and removing errors in the program is called:
a. Compiling b. Debugging
c. Executing d. Coding
216. In Python, a _____ is a tool to find and fix errors in code.
a. Debugger b. Fault Finder
c. Error Tracker d. Linter
27 | P a g e
Computer Science Class-11
28 | P a g e