πŸ“Š Python
Q. Consider the following code segment and identify what will be the output of given Python code?
Code:
a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))

if a <= 0:
    b = b +1
else:
    a = a + 1
  • (A) if inputted number is a negative integer then b = b +1
  • (B) if inputted number is a positive integer then a = a +1
  • (C) Both A and B
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (C) Both A and B
πŸ“Š Python
Q. In Python, ___ defines a block of statements.
  • (A) Block
  • (B) Loop
  • (C) Indentation
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (C) Indentation
πŸ“Š Python
Q. An ___ statement has less number of conditional checks than two successive ifs.
  • (A) if else if
  • (B) if elif
  • (C) if-else
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (C) if-else
πŸ“Š Python
Q. In Python, the break and continue statements, together are called ___ statement.
  • (A) Jump
  • (B) goto
  • (C) compound
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (B) goto
πŸ“Š Python
Q. What will be the output of the following Python code?
Code:
num = 10

if num > 0:
    print("Positive number")
elif num == 0:
    print("Zero")
else:
    print("Negative number")
  • (A) Positive number
  • (B) Negative number
  • (C) Real number
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (A) Positive number
πŸ“Š Python
Q. What will be the output of the following Python code?
Code:
i=5
if  i>11 : print ("i is greater than 11")
  • (A) No output
  • (B) Abnormal termination of program
  • (C) Both A and B
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (C) Both A and B
πŸ“Š Python
Q. What will be the output of the following Python code?
Code:
a = 13
b = 15
print("A is greater") if a > b else print("=") if a == b else print("B is greater")
  • (A) A is greater
  • (B) B is greater
  • (C) Both A and B
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (B) B is greater
πŸ“Š Python
Q. Loops are known as ___ in programming.
  • (A) Control flow statements
  • (B) Conditional statements
  • (C) Data structure statements
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (A) Control flow statements
πŸ“Š Python
Q. The for loop in Python is used to ___ over a sequence or other iterable objects.
  • (A) Jump
  • (B) Iterate
  • (C) Switch
  • (D) All of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (B) Iterate
πŸ“Š Python
Q. The continue keyword is used to ___ the current iteration in a loop.
  • (A) Initiate
  • (B) Start
  • (C) End
  • (D) None of the mentioned above
πŸ’¬ Discuss
βœ… Correct Answer: (C) End