AKTU Python Programming 3rd Week Quiz Solution



AKTU ICT Academy Python Programming a practical Approach 3rd 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 will be the output of the following? a=[1,2,3,4,5,6] b=[q for q in a if q%2==0]            print(b)

(a): 2,4,6
(b): false
(c): 1,3,5
(d): 0
Answer: (a)  2,4,6

[2] What will be the third item in the following? n=[-1,2,3,-4,5,-6] a=[(x, abs(x)) for x in n] print(a)

(a): (-4,4)
(b): (3,3)
(c): (2,2)
(d): (-1,1)
Answer: (b) (3,3)

[3] If A=set(‘python’) and B=set(‘programming’) What is the output of A-B ?

(a): {‘m’, ‘r’, ‘i’}
(b): {‘m’, ‘r’, ‘g’, ‘a’, ‘i’}
(c): {‘h’, ‘y’, ‘t’}
(d): {‘y’, ‘h’, ‘t’, ‘a’}
Answer: (c) {‘h’, ‘y’, ‘t’}

[4] What will be the output of the following? a=5 if a=6: print(“Hello!”) else: print(“Hi”)

(a): HelloHi
(b): Hello
(c): Hi
(d): Error
Answer: (d) Error

[5] If A=set(‘apple’, ‘orange’, ‘pear’) then what is the class of A ?

(a): list
(b): tuple
(c): int
(d): set
Answer: (d) set

[6] What should be the outcome of the following? count=40 count>=30 and count<39

(a): True
(b): False
(c): Error
(d): None of above
Answer: (b) False


[7] If names=[‘abhay’, ‘mahesh’, ‘prashant’, ‘sandeep’] , what does the following statement do: ‘rakesh’ in names

(a): checks if ‘rakesh’ is there in names
(b): deletes ‘rakesh’ from names
(c): add ‘raksesh’ to names
(d): append names with ‘rakesh’
Answer: (a) checks if ‘rakesh’ is there in names
Also, See: Python Quiz -Programming 1st and 2nd Week Quiz Solution
[8] If you want to check if the age is equal to or greater than 18, what should                 come  in the blank: if age___18: print(“You can vote.”)

(a): <
(b): >!
(c): <=
(d):>=
Answer: (d) >=

[9] If names=[‘monu’,’raman’,’shikhar’] , What will be the outcome of the following? if             ‘david’ in names: print (“It’s David”) elif ‘monu’ in names: print (“It’s Monu”) elif                 ‘shyam’ in names: print(“It’s Shyam”)

(a): Error
(b): It’s David
(c): It’s Monu
(d): It’s Shyam
Answer:(c) It’s Monu

[10] What will be the output of the following code: a=10 if a%2==0: print (“Even”) else:           print (“Odd”)

(a): None of the following
(b): Error
(c): Odd
(d): Even
Answer: (d) Even

[11]  if statement along with an else statement in Python is called ______ statement.

(a): elif
(b): elseif
(c): elsif
(d): ifelse
Answer: (a) elif

[12] if statements in Python should be:

(a): maintainable
(b): readable
(c): efficient
(d): all of the above
Answer: (d) all of the above

[13] What will be the output of the following? (3 < 1) and (4/0 > 1)

(a): False
(b): True
(c): Run-time error
(d): None of the above
Answer: (a) False

[14] In Python ‘And’ and ‘Or’ operators are also called:

(a): Short circuit operators
(b): Logical operators
(c): Both A and B
(d): None of the above
Answer: (c) Both A and B

[15] In the following statement, which operation will be evaluated first according to the order of precedence of operators in Python? (3*20+5)-16/4

(a): (3*20+5)
(b): 16/4
(c): 20+5
(d):3*20
Answer: (d)  3*20
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