

InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
1. |
What does 3 ^ 4 evaluate to?(a) 81(b) 12(c) 0.75(d) 7This question was posed to me in an online quiz.The query is from Numeric Types topic in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct option is (d) 7 |
|
2. |
What is the result of round(0.5) – round(-0.5)?(a) 1.0(b) 2.0(c) 0.0(d) Value depends on Python versionI got this question in an online interview.My doubt stems from Numeric Types topic in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» RIGHT choice is (d) Value depends on Python version Easiest explanation - The behavior of the ROUND() function is different in Python 2 and Python 3. In Python 2, it rounds off NUMBERS away from 0 when the NUMBER to be rounded off is exactly halfway through. round(0.5) is 1 and round(-0.5) is -1 whereas in Python 3, it rounds off numbers towards nearest EVEN number when the number to be rounded off is exactly halfway through. See the below output. |
|
3. |
Which of the following is incorrect?(a) float(‘inf’)(b) float(‘nan’)(c) float(’56’+’78’)(d) float(’12+34′)This question was addressed to me by my school teacher while I was bunking the class.My question is based upon Numeric Types topic in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The CORRECT CHOICE is (d) float(’12+34′) |
|
4. |
What is the result of cmp(3, 1)?(a) 1(b) 0(c) True(d) FalseI have been asked this question during an interview for a job.The origin of the question is Numeric Types topic in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct OPTION is (a) 1 |
|
5. |
Which of the following is incorrect?(a) x = 0b101(b) x = 0x4f5(c) x = 19023(d) x = 03964I had been asked this question in class test.This intriguing question comes from Numeric Types topic in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The correct OPTION is (d) X = 03964 |
|
6. |
What does ~~~~~~5 evaluate to?(a) +5(b) -11(c) +11(d) -5I had been asked this question by my school principal while I was bunking the class.I need to ask this question from Numeric Types topic in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The correct answer is (a) +5 |
|
7. |
What does ~4 evaluate to?(a) -5(b) -4(c) -3(d) +3The question was asked during an online interview.My doubt is from Numeric Types topic in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The CORRECT OPTION is (a) -5 |
|
8. |
What is the type of inf?(a) Boolean(b) Integer(c) Float(d) ComplexThe question was posed to me during an interview for a job.This interesting question is from Numeric Types topic in section Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The CORRECT choice is (c) Float |
|
9. |
Which of the following is not a complex number?(a) k = 2 + 3j(b) k = complex(2, 3)(c) k = 2 + 3l(d) k = 2 + 3JI have been asked this question during an online interview.I need to ask this question from Numeric Types in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Right OPTION is (C) k = 2 + 3l |
|
10. |
What is the output of print 0.1 + 0.2 == 0.3?(a) True(b) False(c) Machine dependent(d) ErrorThe question was asked by my school teacher while I was bunking the class.I want to ask this question from Numeric Types in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The correct ANSWER is (b) False |
|
11. |
What is the return value of trunc()?(a) int(b) bool(c) float(d) NoneThis question was posed to me in examination.My query is from Core Data types in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» CORRECT choice is (a) int For EXPLANATION: EXECUTE help(math.trunc) to get DETAILS. |
|
12. |
Which of the following will run without errors?(a) round(45.8)(b) round(6352.898,2,5)(c) round()(d) round(7463.123,2,1)This question was posed to me in quiz.The above asked question is from Core Data types topic in section Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct option is (a) round(45.8) |
|
13. |
Given a function that does not return any value, What value is thrown by default when executed in shell.(a) int(b) bool(c) void(d) NoneI had been asked this question during an online exam.The query is from Core Data types in chapter Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The correct option is (d) None |
|
14. |
Which of these in not a core data type?(a) Lists(b) Dictionary(c) Tuples(d) ClassThis question was addressed to me in class test.I want to ask this question from Core Data types topic in section Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct answer is (d) CLASS |
|
15. |
Which one of the following has the highest precedence in the expression?(a) Exponential(b) Addition(c) Multiplication(d) ParenthesesI got this question in an interview for job.My doubt is from Basic Operators topic in chapter Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The correct answer is (d) Parentheses |
|
16. |
The expression Int(x) implies that the variable x is converted to integer.(a) True(b) FalseI got this question during an internship interview.Asked question is from Basic Operators in chapter Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The CORRECT OPTION is (a) True |
|
17. |
Which one of the following has the same precedence level?(a) Addition and Subtraction(b) Multiplication, Division and Addition(c) Multiplication, Division, Addition and Subtraction(d) Addition and MultiplicationI have been asked this question by my college professor while I was bunking the class.This interesting question is from Basic Operators topic in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The correct choice is (a) ADDITION and Subtraction |
|
18. |
What is the output of this expression, 3*1**3?(a) 27(b) 9(c) 3(d) 1I had been asked this question by my college professor while I was bunking the class.My enquiry is from Basic Operators topic in section Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct option is (c) 3 |
|
19. |
Operators with the same precedence are evaluated in which manner?(a) Left to Right(b) Right to Left(c) Can’t say(d) None of the mentionedThis question was addressed to me in my homework.This intriguing question comes from Basic Operators topic in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» RIGHT OPTION is (a) LEFT to Right The best I can EXPLAIN: NONE. |
|
20. |
Mathematical operations can be performed on a string.(a) True(b) FalseThe question was asked in an online interview.My enquiry is from Basic Operators topic in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» RIGHT ANSWER is (B) False Explanation: You can’t perform mathematical OPERATION on string even if the string is in the FORM: ‘1234…’. |
|
21. |
What is the answer to this expression, 22 % 3 is?(a) 7(b) 1(c) 0(d) 5I had been asked this question in final exam.My question is based upon Basic Operators topic in chapter Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct answer is (B) 1 |
|
22. |
Which one of these is floor division?(a) /(b) //(c) %(d) None of the mentionedI got this question in class test.Origin of the question is Basic Operators topic in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct option is (B) // |
|
23. |
Which is the correct operator for power(x^y)?(a) X^y(b) X**y(c) X^^y(d) None of the mentionedI had been asked this question in an online quiz.I want to ask this question from Basic Operators topic in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» RIGHT CHOICE is (b) X**y To explain I would say: In python, power OPERATOR is x**y i.e. 2**3=8. |
|
24. |
Which of the following cannot be a variable?(a) __init__(b) in(c) it(d) onI had been asked this question at a job interview.Question is taken from Variable Names in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» RIGHT CHOICE is (b) in The best I can explain: in is a keyword. |
|
25. |
Which of the following is an invalid statement?(a) abc = 1,000,000(b) a b c = 1000 2000 3000(c) a,b,c = 1000, 2000, 3000(d) a_b_c = 1,000,000I got this question in class test.The origin of the question is Variable Names in chapter Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The correct ANSWER is (b) a b c = 1000 2000 3000 |
|
26. |
Which of the following is true for variable names in Python?(a) unlimited length(b) all private members must have leading and trailing underscores(c) underscore and ampersand are the only two special characters allowed(d) none of the mentionedThis question was posed to me in unit test.Question is taken from Variable Names in chapter Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» RIGHT choice is (a) UNLIMITED LENGTH To explain I would say: VARIABLE NAMES can be of any length. |
|
27. |
All keywords in Python are in _________(a) lower case(b) UPPER CASE(c) Capitalized(d) None of the mentionedThe question was asked in an online quiz.Question is taken from Variable Names topic in section Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Right ANSWER is (d) NONE of the mentioned |
|
28. |
Which of the following is not a keyword?(a) eval(b) assert(c) nonlocal(d) passThe question was asked in examination.My doubt is from Variable Names topic in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Right ANSWER is (a) EVAL |
|
29. |
Why are local variable names beginning with an underscore discouraged?(a) they are used to indicate a private variables of a class(b) they confuse the interpreter(c) they are used to indicate global variables(d) they slow down executionThe question was posed to me in an internship interview.Enquiry is from Variable Names topic in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct option is (a) they are used to indicate a PRIVATE VARIABLES of a class |
|
30. |
Which of the following is an invalid variable?(a) my_string_1(b) 1st_string(c) foo(d) _The question was posed to me in an interview.The question is from Variable Names topic in section Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The correct choice is (B) 1st_string |
|
31. |
Which of the following is invalid?(a) _a = 1(b) __a = 1(c) __str__ = 1(d) none of the mentionedThe question was asked during a job interview.My question is from Variable Names in section Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct choice is (d) NONE of the mentioned |
|
32. |
What is the maximum possible length of an identifier?(a) 31 characters(b) 63 characters(c) 79 characters(d) none of the mentionedI had been asked this question in my homework.The origin of the question is Variable Names topic in portion Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» Correct answer is (d) NONE of the mentioned |
|
33. |
Is Python case sensitive when dealing with identifiers?(a) yes(b) no(c) machine dependent(d) none of the mentionedThis question was posed to me during an interview.The above asked question is from Variable Names in division Variable Names, Operators, Data Types & Numeric Types of Python |
Answer» The CORRECT OPTION is (a) yes |
|