Which of the following is a distinct syntactic block ?
a.
Subroutines
b.
Function
c.
Definition
d.
Modules
Correct Answer
Step-by-Step AI Explanation
Verified Method
Modules are a distinct syntactic block because they group related definitions and statements into a separate unit. Subroutines and functions are blocks inside programs, but in Python a module itself is treated as a separate syntactic unit. Definition is not a specific block type.
Q2mcq1 mark
Which of the following functions that build the abstract data type ?
a.
Constructors
Correct Answer
b.
recursive
c.
Destructors
d.
Nested
Step-by-Step AI Explanation
Verified Method
Constructors are functions that build or initialize an abstract data type (ADT) by creating its instances and setting up their initial state. Recursive, destructors, and nested are not the functions specifically used to build an ADT.
Q3mcq1 mark
The __________ rule is used to decide the order in which the scopes are to be searched.
a.
LBEG
b.
LEGB
Correct Answer
c.
GEBL
d.
GBLE
Step-by-Step AI Explanation
Verified Method
The LEGB rule is used to decide the order in which scopes are searched in Python: Local, Enclosing, Global, and Built-in. The other options are not standard scope-search rules.
Q4mcq1 mark
Binary search is also called as __________.
a.
Random search
b.
Linear search
c.
Half-interval search
Correct Answer
d.
Sequential search
Step-by-Step AI Explanation
Verified Method
Binary search is also called half-interval search because it repeatedly divides the search interval into two halves to locate the required element. It is not random, linear, or sequential search.
Q5mcq1 mark
Which operator is also called as conditional operator ?
a.
Logical
b.
Ternary
Correct Answer
c.
Assignment
d.
Relational
Step-by-Step AI Explanation
Verified Method
The ternary operator is also called the conditional operator because it evaluates one of two expressions based on a condition. Logical, assignment, and relational operators are different categories of operators.
Q6mcq1 mark
Which of the following is known as definite loop ?
a.
for
Correct Answer
b.
do...while
c.
if...else
d.
while
Step-by-Step AI Explanation
Verified Method
The for loop is known as a definite loop because the number of iterations is known in advance. The do...while and while loops are generally indefinite loops, and if...else is a selection statement, not a loop.
Q7mcq1 mark
Which of the following keyword is used to exit a function block ?
a.
finally
b.
define
c.
def
d.
return
Correct Answer
Step-by-Step AI Explanation
Verified Method
The return keyword is used to exit from a function block and optionally send a value back to the caller. finally, define, and def do not exit a function block.
Q8mcq1 mark
The subscript of a string may be :
a.
positive or negative numbers
Correct Answer
b.
positive numbers
c.
both positive and negative numbers
d.
negative numbers
Step-by-Step AI Explanation
Verified Method
The subscript of a string may be positive or negative. Positive indexing starts from the beginning of the string, while negative indexing starts from the end. Hence both positive and negative numbers are allowed.
Q9mcq1 mark
Which of the following is the output of the given Python code ?
str1 = "Computer Science"
print(str1[::-1])
a.
ecneicS retupmoC
Correct Answer
b.
Computer Science
c.
eniS eumC
d.
Cmue Sine
Step-by-Step AI Explanation
Verified Method
The code uses slicing with a step of -1: `str1[::-1]`. This reverses the string, so `Computer Science` becomes `ecneicS retupmoC`. Hence, option (a) is correct. The other options are not the reversed output.
Q10mcq1 mark
Class members are accessed through which operator ?
a.
#
b.
&
c.
%
d.
.
Correct Answer
Step-by-Step AI Explanation
Verified Method
Class members are accessed through the dot operator `.`. It is used to access methods and attributes of a class or object, for example `obj.method()`. So, option (d) is correct.
🎉 10 Free Sample Solutions Completed
Unlock All 38 Questions & Solutions
Sign up free in seconds to unlock step-by-step AI answers for the remaining 28 questions.
(a)Write the output of the following.
A={1,2,3,4,5}
B={4,5,6,7,8}
print(A|B)
print(A&B)
print(A-B)
print(B-A)
print(A^B)
OR
(b)Explain the following SQL aggregate functions with suitable Python statement with SQL query.
(i)AVG( )
(ii)COUNT( )
(iii)SUM( )
(iv)MAX( )
(v)MIN( )
Correct Answer & Step-by-Step Solution Locked
Sign in free to reveal the correct answer and AI explanation for this question.