Python MCQs
1) Store code in a file and use the interpreter to execute the contents of the file, which is called a ___________.
A)script B) interpreter C) compiler D) object code
Correct Ans:script
2) A ___________ is a sequence of instructions that specifies how to perform a computation.
A)input B)output C)math D) program
Correct Ans: program
3)___________Perform basic mathematical operations like addition and multiplication.
A)input B)output C)math D) program
Correct Ans: math
4) _______________ refers to the structure of a program and the rules about that structure.
A)syntax B)runtime C)semantic D) logical
Correct Ans: syntax
5) ______________ is the process of formulating a problem, finding a solution, and expressing the solution.
A)problem solving B) portability C) interpret D) compile
Correct Ans: problem solving
6) A __________ is one of the basic things a program works with, like a letter or a number.
A)code B)value C)algorithm D) bug
Correct Ans: value
7) ___________ are special symbols that represent computations like addition and multiplication.
A) literals B)data types C)Operators D) operands
Correct Ans: Operators
8) An ____________ is a combination of values, variables, and operators.
A) expression B) literals C)data types D) algorithm
Correct Ans: expression
9) When more than one operator appears in an expression, the order of evaluation depends on the rules of ___________.
A)associativity B)precedence C)compiler D) executable code
Correct Ans: precedence
10) A __________ is a file that contains a collection of related functions.
A)object B) code C)module D) class
Correct Ans: module
11) A ________________ specifies the name of a new function and the
sequence of statements that execute when the function is called.
A)function definition B)module C)class D) program
Correct Ans: function definition
12) In order to ensure that a function is defined before its first use, you have to know the order in which statements are executed, which is called the __________.
A)function defination B)flow of execution C) executable code D) program
Correct Ans: flow of execution
13) Inside the function, the arguments are assigned to variables called ______________.
A) parameters B)data types C)values D) object
Correct Ans: parameters
14) When you create a variable inside a function, it is _______.
A)static B)dynamic C)gobal D) local
Correct Ans: local
15) To keep track of which variables can be used where, it is sometimes useful to draw a ______________.
A) stack diagram B)algorithm C)operators D) program
Correct Ans: stack diagram
16) You can call one function from within another. This ability is called ____________.
A) boolean functions B)function defination C)stack diagram D) composition
Correct Ans: composition
17) A __________ is a sequence of characters.
A)string B)object C)function D) slice
Correct Ans: string
18) A segment of a string is called a _________.
A)string B)object C)function D) slice
Correct Ans: slice
19)__________ are immutable.
A)string B)object C)numbers D) list
Correct Ans: string
20) In list a relationship between indices and elements, is called a ___________.
A)string B)sequence C)mapping D) slice
Correct Ans: mapping
21) The association of a key and a value is called a _________ pair.
A)class-object B)data-type C)local-global D) key-value
Correct Ans: key-value
22) Given a dictionary d and a key k, it is easy to find the corresponding value v = d[k]. This operation is called a _____________.
A) lookup B)items C)elements D) operation
Correct Ans: lookup
23) The _______ method is a special method that gets invoked when an object is instantiated.
A) user defined B) init C) built in D)str method
Correct Ans: init
24) Functions that can work with several types are called _________.
A)enumeration B)inheritance C)encapsulation D) polymorphic
Correct Ans: polymorphic
25) Inheritance is the ability to define a new class that is a modified version of an existing class.
A)enumeration B)inheritance C)encapsulation D) polymorphic
Correct Ans: inheritance
26) A ____________ is a graphical representation of these relationships.
A)class-object B)algorithm C)class diagram D) polymorphic
Correct Ans: class diagram
27) ___________ is a notation in a class diagram that shows, for a HAS-A relationship, how many references there are to instances of another class.
A)IS-A relationship B)algorithm C)class diagram D) multiplicity
Correct Ans: multiplicity
28) __________ ia a widget, containing text or an image, that performs an action when pressed.
A)button B)canvas C)entry D) frame
Correct Ans: button
29) One of the most versatile widgets is the Canvas, which creates a region for drawing lines, circles and other shapes.
A)button B)canvas C)entry D) frame
Correct Ans: canvas
30) Arranging widgets in a GUI is called __________.
A)placing B)packing C)implementing D) framing
Correct Ans: packing
Comments
Post a Comment