AKTU Python Programming 6th Week Quiz Solutions


AKTU ICT Academy Python Programming a practical Approach 6th Week Quiz Solutions

Hey guys here are the solutions of AKTU ICT Academy Python quiz solutions for the first week. AKTU released noncredit courses for 2nd-year computer science students of B. Tech. The course code is KNC 301/KNC 302.


These answers are for all those who have confusion in the questions or they don’t want to submit wrong answers. Please attempt the quiz yourself before proceeding for the answers.

Disclaimer :- I don't claim for the 100% accuracy of the answers. I tried my level best to present the correct answers and I'm not responsible if any of the answer is incorrect.



[1]  What is the output of the following Python3 program (using python 3.X version):

i = 1

while i <= 10:     

    if i%2==0: # even     

        continue 

    print (i, end=’ ‘) 

    i= i+1

(a): 1 3 5 7 9
(b): 2 4 6 8 10
(c): The program will go into an infinite loop, printing 1 1 1 …
(d): The program will go into an infinite loop (after possibly printing a single 1)
Answer:(d) The program will go into an infinite loop (after possibly printing a single 1)


[2] What is the output of the following Python3 program (using python 3.X version):

i = 1

while i <= 10:     

    i= i+1

    if i%2==0: # even     

        continue 

    print (i, end=’ ‘)

(a): 3 5 7 9 11
(b): 1 3 5 7 9
(c): The program will go into an infinite loop, printing 1 1 1 …
(d): The program will go into an infinite loop, printing nothing
Answer:(a) 3 5 7 9 11


[3] What is the output of the following Python3 program (using python 3.X version):

i = 1

while i <= 10:     

    if i%2==0: # even

        i= i+1

        continue 

    print (i, end=’ ‘)

(a): 3 5 7 9 11
(b): 1 3 5 7 9
(c): The program will go into an infinite loop, printing 1 1 1 …
(d): The program will go into an infinite loop, printing nothing
Answer: (c) The program will go into an infinite loop, printing 1 1 1 …


[4] What is the output of the following Python3 program (using python 3.X version):

i = 1

while i <= 10:     

    if i%2==0: # even

        i= i+1

        continue 

    print (i, end=’ ‘) 

    i= i+1

(a): 3 5 7 9 11
(b): 1 3 5 7 9
(c): The program will go into an infinite loop, printing 1 1 1 …
(d): The program will go into an infinite loop, printing nothing
Answer:(b) 1 3 5 7 9


[5] What is the output of the following program (using python 3.X version):

r,a,n = 2,10,20

term = a

for i in range(n):

    term = term * r

    if (i > 3):

        break

print (term)

(a): 40
(b): 80
(c): 160
(d): 320
Answer(d) 320


[6] Which of the following statements is NOT true about Python functions:

(a): A function can be called only once in a program.
(b): A function allows us to break a program into small, independent tasks.
(c): A function can call other functions.
(d): Python provides several helpful functions
Answer:(a) A function can be called only once in a program.


[7] Functions allow us to “divide and conquer” a complex programming task into simpler programming tasks.

(a): True
(b): False
Answer:(a) True


[8]  Functions are the only way to write modular programs in Python.

(a): True
(b): False
Answer:(b) False


[9]  Assume that the “min” function computes the minimum of two values, and “max” function computes the maximum of two values. Let x1, x2, x3 and x4 be 4 distinct integers. What can you say about the following program (using python 3.X version):
y1 = min(x1, x2)

        y2 = min(x3, x4)

        y3 = max(y1, y2)

(a): y3 is the largest integer among x1, x2, x3, x4.
(b): y3 is either the largest or the second largest integer among x1, x2, x3, x4.
(c): y3 is either the second largest or the third largest integer among x1, x2, x3, x4.
(d): y3 is the third largest integer among x1, x2, x3, x4.
Answer: (a)  y3 is the largest integer among x1, x2, x3, x4.


[10]

Assume that the “min” function computes the minimum of two values, and “max” function computes the maximum of two values. Let x1, x2, x3 and x4 be 4 distinct integers. What can you say about the following program (using python 3.X version):
y1 = min(x1, x2)

 y2 = min(x3, x4)

 y3 = x1 + x2 – y1

 y4 = x3 + x4 – y2

 y5 = max(y3, y4)

(a): y5 is the largest integer among x1, x2, x3, x4.
(b): y5 is either the largest or the second largest integer among x1, x2, x3, x4.
(c): y5 is either the second largest or the third largest integer among x1, x2, x3, x4.
(d): Can not say anything as the data is not sufficient.
Answer:(c) y5 is either the second largest or the third largest integer among x1, x2, x3, x4.

SHARE If you find this useful, please share with your friends and Community.
CODE TOGETHER..GROW TOGETHER.
Newer Posts Newer Posts Older Posts Older Posts

More posts

Comments

Post a Comment

Sponsored Content