AI With Python MCQ's
AI With Python MCQ's
Q4. Mathematical operations can be performed on a string. State whether true or false -
False
A. True
Q5. Which one of the following has the highest precedence in the expression?
Addition
Multiplication
Exponential
Parentheses
Q7. What is the output of the following? print("Hello {0!r} and {0!s}".format('foo', 'bin'))
Hello ‘foo’ and foo
Hello foo and foo
Hello foo and ‘bin’
Error
Q12. Python allows string slicing. What is the output of below code: s='cppbuzz chicago' print(s[3:5])
buzzc
pbuzz
bu
None of these
Q13. class test: def init (self): print "Hello World" def init (self): print "Bye
World" obj=test()
Bye World
Hello World
Compilation Error
Ambiguity
Q19. 19 % 2 in python
2
17
None of these
Q 22. Among the given options, which search algorithm requires less memory?
• Optimal Search
• Depth First Search
• Breadth-First Search
• Linear Search
Q 23.Which one of the following is the correct extension of the Python file?
• .py
• .python
• .p
• None of these
Q 24. Which of the following statements is correct for variable names in Python language?
• All variable names must begin with an underscore.
• Unlimited length
• The variable name length is a maximum of 2.
• All of the above
Q 29.Which of the following search algorithm searches forward from initial state and backward from goal
state till both meet to identify a common state?
• Uniform Cost Search
• Iterative Deepening Depth-First Search
• Bidirectional Search
• None of the Above