Python
Python
n=7
a)True
b) False
C) Syntax error
Answer: b) False
5. Which of the following is not a valid built-in method for type conversion in Python?
a) Int
b) float
c) list
d) char
Answer : d) char
a) 0 1 2 3
b) 0 1 2
c) 0 1 2 3 4
d) 1 2
Answer: b) 0 1 2
a) O(n2)
b) O(log n)
c) O(n)
d) O(n log n)
Answer: c) O(n)
8. what is the purpose of loop in python?
a) To define functions in Python.
a) 105
b) 120
c) 65
d) 75
Answer: c) 65
Answer: output
myqueue = [1, 2, 3, 4, 5, 6, 7, 8, 9]
16. find the output of the following snippet?
for num in range(15,-6,-4):
print (num)
Answer: output is
15
11
7
3
-1
-5
17. Consider a situation where an incorrect value has been inserted into an
environment variable by another developer and you are asked to remove that
variable's value. The variable's name is "NAME". Which option will you choose
from the listed choices in order to complete the given requirement?
a) remove NAME
b) unset NAME
c) export NAME
d) autoremove NAME
Answer: b) unset NAME
18. When the computer is directed to perform an illegal operation by the
program such as dividing a number by zero then the type of error shown is
a) Syntax Error
b) Logical Error
c) Run Time Error
d) zerodivision Error
Answer: c) Run Time Error
19. Which of the following iterative statement execute at least once?
a) for loop
b) while loop
c) do while loop
d) break
Answer: c) do while loop
20. Allocation and Deallocation of the resource required to execute the
program is done by
a) Operating System
b) Compiler
c) Linker
d) Loader
Answer: a) Operating System
21. The correct sequence of the below steps to reverse the ian song
1 Initiate
2. Get the length of the string
3 Start a loop and then swap the position of the array elements
4 Keep the exchanged positions.
5. Print the reversed string.
6. The string which is to be reversed is declared.
Answer: 1, 6, 3, 4, 5, 2.
22. Read the instructions and complete the program
Kalyani, the process in which Python reclaims unused memory blocks at a
periodic interval is termed as
a) Reclamation
b) Compaction
c) Garbage Collection
d) None of the these
Answer: c) Garbage Collection
23. what is the output of the following snippet?
while (true)
// Some code here
if (some condition)
break the loop
}
}
a) it will run forever
b) It will run till "some condition" is satisfied
c) It will run only if "some condition" is satisfied
--------------------------------------------------------------------------------------------------------------------------
Python Codings:
1) name = input() output:
print ("Hello, " + name) Hello, Doselect