Question
Question
Pre-Mid Term-2022
Section-A (MCQ) [ 1X 6= 6 ]
Q1: Which of the following is an invalid variable?
(a) _3 (b) Day_four (c) My_day_5 (d) 6_day
Q2: What is the value of x ?
x=int(13.25+4/2)
(a) 17 (b) 14 (c) 23 (d) 15
Q3: Which line of code produces an error ?
(a) “one” + ‘two’ (b) 1+2 (c) “one”+”2” (d) ‘1’+2
Q4: Suppose a tuple T is declared as T = (10,12,43,39), which of the following is incorrect?
(a) print(T[1]) (b) T[2]= -29 (c) print(max[T]) (d) print(len(T))
Q5: Which of the following keywords marks the beginning of the function block ?
(a) func (b) define (c) def (d) function
Q6: A Python module has _________extension.
(a) .mod (b) .imp (c) .py (d) .mpy
Section-B [ 2X 8 = 16 ]
Q7: What is a module and a library ?
Q8: Name the Python Library modules which need to be imported to invoke the following
functions:
(a) log() (b) radint (c) sqrt() (d) pow()
Q9: What will be the output of following program ?
(a) (b)
def display(): num=1
def myfunc():
print(“Hello”, end= ‘ ‘)
return num
display() print(num)
print(“there!”) print(myfunc())
print(num)
Value=30
For VAL in range(0,Value)
If val%4 ==0:
Print(VAL * 4)
Elseif val % 5 ==0:
Print(VAL + 3)
Else
Print(VAL+10)
Section-C [ 3 X 6 = 18 ]
Q15: What do you understand by the term Iteration? Explain with example.
Q16: How many times will the following for loop execute and what is the output?
for I in range(-1,7,2):
for j in range(3):
print(I,j)
Q17: Find the error in following code. State the reason of the error.
Pass parameter as per your choice and call both the functions properly.
******************************************************************