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

Posted Date:-2021-12-29 23:14:53


Question:
 Is Python case sensitive when dealing with identifiers?

1. yes

2.no

3.machine dependent

4.none of the mentioned

Posted Date:-2021-12-29 19:27:27


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’)

Posted Date:-2021-12-29 23:19:49


Question:
 What data type is the object below?

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

1. list

2.dictionary

3.array

4. tuple

Posted Date:-2021-12-29 23:17:43


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

1.True

2. False

3.Machine dependent

4.Error

Posted Date:-2021-12-29 23:21:04


Question:
 What is the type of inf?

1.Boolean

2.Integer

3.Float

4.Complex

Posted Date:-2021-12-29 23:22:03


Question:
 Which of the following is incorrect?

1.float(‘inf’)

2.float(‘nan’)

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

4.float(’12+34′)

Posted Date:-2021-12-29 23:24: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

Posted Date:-2021-12-29 23:27:35


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

Posted Date:-2021-12-29 23:18:06


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

Posted Date:-2021-12-29 23:16:47


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

Posted Date:-2021-12-29 23:03:28


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

Posted Date:-2021-12-29 23:29:48


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

1. +5

2.-11

3.+11

4. -5

Posted Date:-2021-12-29 23:22:55


Question:
What does ~4 evaluate to?

1. -5

2.-4

3.-3

4.+3

Posted Date:-2021-12-29 23:22:27


Question:
What does 3 ^ 4 evaluate to?

1. 81

2.12

3. 0.75

4. 7

Posted Date:-2021-12-29 23:25:32


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

apple = mango

1.SyntaxError

2.NameError

3. ValueError

4. TypeError

Posted Date:-2021-12-29 23:17:11


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

1.7

2. 1

3. 0

4.5

Posted Date:-2021-12-29 23:02:57


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

1.31 characters

2.63 characters

3.79 characters

4.none of the mentioned

Posted Date:-2021-12-29 19:27:59


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

1. 27

2.9

3.3

4. 1

Posted Date:-2021-12-29 23:03:50


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

1. 1

2.0

3.True

4.False

Posted Date:-2021-12-29 23:24:03


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

Posted Date:-2021-12-29 23:25:05


Question:
What is the return type of function id?

1.int

2.float

3.bool

4. dict

Posted Date:-2021-12-29 23:16:05


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

1.int

2.bool

3.float

4.None

Posted Date:-2021-12-29 23:20:11


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)

Posted Date:-2021-12-29 23:28:50


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)

Posted Date:-2021-12-29 23:30:09


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

Posted Date:-2021-12-29 23:30:31


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)

Posted Date:-2021-12-30 00:20:56


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

Posted Date:-2021-12-29 23:31:38


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

4 + 3 % 5

1. 4

2.7

3.2

4.0

Posted Date:-2021-12-29 23:27:03


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

4+2**5//10

1.3

2.7

3. 77

4.0

Posted Date:-2021-12-30 00:23:12


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

Posted Date:-2021-12-30 00:21:52


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

Posted Date:-2021-12-30 00:20:02


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

Posted Date:-2021-12-29 23:28:27


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

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

1. <<, >>

2.**

3.|

4.%

Posted Date:-2021-12-30 00:21:24


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

1.X^y

2.X**y

3. X^^y

4.none of the mentioned

Posted Date:-2021-12-29 23:02:01


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

Posted Date:-2021-12-30 00:20:26


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

Posted Date:-2021-12-30 00:22:21


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

1.float(‘10’)

2.int(‘10’)

3.float(’10.8’)

4. int(’10.8’)

Posted Date:-2021-12-30 00:22:46


Question:
Which of the following is an invalid variable?

1.my_string_1

2.1st_string

3.foo

4. _

Posted Date:-2021-12-29 19:28:50


Question:
Which of the following is incorrect?

1. x = 0b101

2. x = 0x4f5

3. x = 19023

4.x = 03964

Posted Date:-2021-12-29 23:23:29


Question:
Which of the following is invalid?

1. _a = 1

2. __a = 1

3.__str__ = 1

4.none of the mentioned

Posted Date:-2021-12-29 19:28:23


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

Posted Date:-2021-12-29 23:21:38


Question:
Which of the following is not a keyword?

1. eval

2.assert

3.nonlocal

4. pass

Posted Date:-2021-12-29 19:29:44


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

1. /

2.%

3. //

4. |

Posted Date:-2021-12-29 23:29:18


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

1. +

2. //

3.%

4.**

Posted Date:-2021-12-29 23:28:04


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”’

Posted Date:-2021-12-29 23:18:59


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)

Posted Date:-2021-12-29 23:15:25


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

1. Lists

2. Dictionary

3. Tuples

4. Class

Posted Date:-2021-12-29 23:14:03


Question:
Which one of these is floor division?

1. /

2. //

3.%

4.none of the mentioned

Posted Date:-2021-12-29 23:02:26


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

Posted Date:-2021-12-29 19:29:21


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
Search
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!