Python quiz for practice

1.) What will be the time complexity of the following code -

number = [1,2,3]
sum = 0
for i in number :
sum = sum + i
print ( sum )

a.) O(n)
b.) O(1)
c.) O(n^2)
d ) O(logn)

2.) What is the use of function?
a.) Code reusability
b ) Code wastage
c.) Ome time use code
d.) None of above

3.) What does linkedlist( node ) consist of ?
a.) Data and transfer
b.) Data and address of next node
c ) Address of next node and connection
d.) None of above

4.) What is the best case time complexity?
a.) O(1)
b.) O(n)
c ) O(logn )
d.) cannot say

1.) What will be the time complexity of the following code -
a.) O(n)
2.) What is the use of function?
a.) Code reusability
3.) What does linkedlist( node ) consist of ?
b.) Data and address of next node
4.) What is the best case time complexity?
a.) O(1)

1 Like

1 a.) O(n)
2 a.) Code reusability
3 b.) Data and address of next node
4 a.) O(1

1 Like

1.a
2.a
3.b
4.answer a

1 Like
  1. c
  2. a
  3. b
    4 ) a
1 Like

Correct, Amazing guys , keep practicing

1.) a
2.) a
3.) b
4.) a

1 Like

correct @juhibasava2716