Python/Python Mcq Set 1 Sample Test,Sample questions

Question:
 Given a function that does not return any value, What value is thrown by default when executed in shell.

1. int

2.bool

3.void

4.None


Question:
 Is Python case sensitive when dealing with identifiers?

1. yes

2.no

3.machine dependent

4.none of the mentioned


Question:
 Select all options that print.

hello-how-are-you

1.print(‘hello’, ‘how’, ‘are’, ‘you’)

2.print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)

3.print(‘hello-‘ + ‘how-are-you’)

4.print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)


Question:
 What data type is the object below?

L = [1, 23, 'hello', 1]

1. list

2.dictionary

3.array

4. tuple


Question:
 What is the output of print 0.1 + 0.2 == 0.3?

1.True

2. False

3.Machine dependent

4.Error


Question:
 What is the type of inf?

1.Boolean

2.Integer

3.Float

4.Complex


Question:
 Which of the following is incorrect?

1.float(‘inf’)

2.float(‘nan’)

3. float(’56’+’78’)

4.float(’12+34′)


Question:
Evaluate the expression given below if A = 16 and B = 15.
A % B // A

1. 0.0

2. 0

3. 1.0

4. 1


Question:
In order to store values in terms of key and value we use what core data type.

1. list

2. tuple

3.class

4.Dictionary


Question:
In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed.

>>>x = 13 ? 2
objective is to make sure x has a integer value, select all that apply (python 3.xx)

1.x = 13 // 2

2. x = int(13 / 2)

3.x = 13 % 2

4.all of the mentioned


Question:
Operators with the same precedence are evaluated in which manner?

1. Left to Right

2.Right to Left

3.Can’t say

4.none of the mentioned


Question:
What are the values of the following Python expressions?

 2**(3**2)
 (2**3)**2
 2**3**2

1.64, 512, 64

2.64, 64, 64

3.512, 512, 512

4.512, 64, 512


Question:
What does 3 ^ 4 evaluate to?

1. 81

2.12

3. 0.75

4. 7


Question:
What does ~4 evaluate to?

1. -5

2.-4

3.-3

4.+3


Question:
What does ~~~~~~5 evaluate to?

1. +5

2.-11

3.+11

4. -5


Question:
What error occurs when you execute the following Python code snippet?

apple = mango

1.SyntaxError

2.NameError

3. ValueError

4. TypeError


Question:
What is the answer to this expression, 22 % 3 is?

1.7

2. 1

3. 0

4.5


Question:
What is the maximum possible length of an identifier?

1.31 characters

2.63 characters

3.79 characters

4.none of the mentioned


Question:
What is the output of this expression, 3*1**3?

1. 27

2.9

3.3

4. 1


Question:
What is the result of cmp(3, 1)?

1. 1

2.0

3.True

4.False


Question:
What is the result of round(0.5) – round(-0.5)?

1.1.0

2.2.0

3. 0.0

4.Value depends on Python version


Question:
What is the return type of function id?

1.int

2.float

3.bool

4. dict


Question:
What is the return value of trunc()?

1.int

2.bool

3.float

4.None


Question:
What is the value of the following expression?

2+4.00, 2**4.0

1. (6.0, 16.0)

2. (6.00, 16.00)

3.(6, 16)

4.(6.00, 16.0)


Question:
What is the value of the following expression?

8/4/2, 8/(4/2)

1. (1.0, 4.0)

2.(1.0, 1.0)

3.(4.0. 1.0)

4.(4.0, 4.0)


Question:
What is the value of the following expression?

float(22//3+3/3)

1.8

2.8.0

3.8.3

4.8.33


Question:
What will be the output of the following Python expression?

24//6%3, 24//4//2

1. (1,3)

2. (0,3)

3.(1,0)

4.(3,1)


Question:
What will be the output of the following Python expression?

print(4.00/(2.0+2.0))

1. Error

2.1.0

3.1.00

4.1


Question:
What will be the value of the following Python expression?

4 + 3 % 5

1. 4

2.7

3.2

4.0


Question:
What will be the value of the following Python expression?

4+2**5//10

1.3

2.7

3. 77

4.0


Question:
What will be the value of the following Python expression?

float(4+int(2.39)%2)

1. 5.0

2.5

3.4.0

4.4


Question:
What will be the value of X in the following Python expression?

X = 2+9*((3*12)-8)/10

1.30.0

2. 30.8

3.28.4

4.27.2


Question:
What will be the value of x in the following Python expression?

x = int(43.55+2/2)

1.43

2. 44

3. 22

4.23


Question:
Which among the following list of operators has the highest precedence?

 +, -, **, %, /, <<, >>, |

1. <<, >>

2.**

3.|

4.%


Question:
Which is the correct operator for power(xy)?

1.X^y

2.X**y

3. X^^y

4.none of the mentioned


Question:
Which of the following expressions involves coercion when evaluated in Python?

1.4.7 – 1.5

2.7.9 * 6.3

3.1.7 % 2

4.3.4 + 4.6


Question:
Which of the following expressions is an example of type conversion?

1. 4.0 + float(3)

2. 5.3 + 6.3

3.5.0 + 3

4. 3 + 7


Question:
Which of the following expressions results in an error?

1.float(‘10’)

2.int(‘10’)

3.float(’10.8’)

4. int(’10.8’)


Question:
Which of the following is an invalid variable?

1.my_string_1

2.1st_string

3.foo

4. _


Question:
Which of the following is incorrect?

1. x = 0b101

2. x = 0x4f5

3. x = 19023

4.x = 03964


Question:
Which of the following is invalid?

1. _a = 1

2. __a = 1

3.__str__ = 1

4.none of the mentioned


Question:
Which of the following is not a complex number?

1.k = 2 + 3j

2. k = complex(2, 3)

3.k = 2 + 3l

4.k = 2 + 3J


Question:
Which of the following is not a keyword?

1. eval

2.assert

3.nonlocal

4. pass


Question:
Which of the following is the truncation division operator?

1. /

2.%

3. //

4. |


Question:
Which of the following operators has its associativity from right to left?

1. +

2. //

3.%

4.**


Question:
Which of the following results in a SyntaxError?

1. ‘”Once upon a time…”, she said.’

2.“He said, ‘Yes!'”

3. ‘3’

4. ”’That’s okay”’


Question:
Which of the following will run without errors?

1.round(45.8)

2.round(6352.898,2,5)

3.round()

4. round(7463.123,2,1)


Question:
Which of these in not a core data type?

1. Lists

2. Dictionary

3. Tuples

4. Class


Question:
Which one of these is floor division?

1. /

2. //

3.%

4.none of the mentioned


Question:
Why are local variable names beginning with an underscore discouraged?

1. they are used to indicate a private variables of a class

2. they confuse the interpreter

3.they are used to indicate global variables

4. they slow down execution


More MCQS

  1. Python MCQS - Function
  2. Python MCQS - GUI in python
  3. Python MCQS - Operators
  4. Python MCQS - Data type in python
  5. Python MCQS - loops in python
  6. Python MCQS - Numpy
  7. Python MCQS - sqlite3
  8. Python MCQS - Library
  9. Python MCQS - Pandas
  10. Python MCQs
  11. Dictionary Python MCQ set 1
  12. Dictionary Python MCQ set 2
  13. MCQ For Python Fundamentals
  14. MCQ Introduction to Python Section 1
  15. MCQ Introduction to Python Section 2
  16. MCQ Introduction to Python Section 3
  17. MCQ on Flow of Control in Python Set 1
  18. MCQ on Flow of Control in Python Set 2
  19. MCQ on Python String Set 1
  20. File Handling in Python section 1
  21. File Handling in Python section 2
  22. Python Functions MCQS Set 1
  23. Python Functions MCQS Set 2
  24. MCQ on List in Python
  25. Pandas MCQ Questions Set 1
  26. Pandas MCQ Questions Set 2
  27. Tuple MCQ in Python
  28. Python dataframe MCQ
  29. Python Mcq Set 1
  30. Python Mcq Set 2
  31. Python Mcq Set 3
  32. Python Mcq Set 4
  33. Python Mcq Set 5
  34. Python Mcq Set 6
  35. Python Mcq Set 7
  36. Python Mcq Set 8
  37. Python Mcq Set 9
  38. Python Mcq Set 10
  39. Python Mcq Set 11
  40. Python Mcq Set 12
  41. Python Mcq Set 13
  42. Python Mcq Set 14
  43. Python Mcq Set 15
  44. Python Mcq Set 16
  45. Python Mcq Set 17
  46. Python Mcq Set 18
  47. Python Mcq Set 19
  48. Python Mcq Set 20
  49. Python Mcq Set 21
  50. Python MCQ
  51. Python MCQ Questions with Answer
  52. Python Practice Papers
  53. python mcq question and answer
  54. Test
Learn Python Mcq Set 1,Learn Python Objetive choice questions and answers,Python Multiple choice questions and answers,Python objective, Python questions , Python answers,Python MCQs questions and answer
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!