πŸ“Š Problem Solving and Python Programming
Q. '.replace('cd', '12'))
  • (A) ab12ef12
  • (B) abcdef12
  • (C) ab12efcd
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) ab12ef12

Explanation: all occurrences of the first substring are replaced by the second substring.

πŸ“Š Problem Solving and Python Programming
Q. Which of the following functions is a built- in function in python?
  • (A) seed()
  • (B) sqrt()
  • (C) factorial()
  • (D) print()
πŸ’¬ Discuss
βœ… Correct Answer: (D) print()

Explanation: the function seed is a function which is present in the random module. the functions sqrt and factorial are a part of the math module. the print function is a built-in function which prints a value directly to the system output.

πŸ“Š Problem Solving and Python Programming
Q. 5676,2)?
  • (A) 4.5
  • (B) 4.6
  • (C) 4.57
  • (D) 4.56
πŸ’¬ Discuss
βœ… Correct Answer: (C) 4.57

Explanation: the function round is used to round off the given decimal number to the specified decimal places. in this case, the number should be rounded off to two decimal places. hence the output will be 4.57.

πŸ“Š Problem Solving and Python Programming
Q. ,0,4.2)
  • (A) true
  • (B) false
  • (C) error
  • (D) 0
πŸ’¬ Discuss
βœ… Correct Answer: (C) error

Explanation: the function all() returns ‘true’ if any one or more of the elements of the iterable are non zero. in the above case, the values are not iterable, hence an error is thrown.

Jump to