Python/MCQ Introduction to Python Section 2 Sample Test,Sample questions

Question:
 Which of the following is not an integer literal?

1.1

2.7

3.98

4.“4”


Question:
 Write the output of the following:
x = int(7) + int (‘9’)
print(x)

1.79

2.16

3.Error

4.None of the above


Question:
101. >>> bool(0) evaluates to _

1.False

2.True

3.Error

4.None of the above


Question:
86. Which of the following is an exponent operator?

1.*

2./

3. **

4.***


Question:
A program written in a high-level language is called _________ code

1. Object

2.Source

3.Machine

4.None of the above


Question:
An ordered set of instructions to be executed by a computer to carry out a specific task is called ___

1.Algorithm

2.Pseudocode

3.Program

4.None of the above


Question:
An _______________ is a symbol which is used to perform specific mathematical or logical operation on values.

1.Operand

2.Operator

3.Keyword

4.Identifier


Question:
By default, the Python scripts are saved in ____

1.Document

2.Desktop

3.Python installation folder

4.D drive


Question:
By default, the Python scripts are saved with ____________ extension.

1.pyp

2.pys

3.py

4.None of the above


Question:
Comments in python program are ________________ by interpreter

1.executed

2. not executed

3.given

4.shared


Question:
Computers understand the language of 0s and 1s which is called _______

1.Machine Language

2.Low level Language

3.Binary Language

4.All the above


Question:
In Python multi line comment starts with _________

1.%

2./*

3.!

4.#


Question:
In Python single line comment starts with __

1.%

2. /*

3.!

4.#


Question:
In which of the following mode, the interpreter executes the statement and displays the result as soon as we press ‘Enter’ key?

1.Interactive mode

2. Script mode

3. Hybrid mode

4.None of the above


Question:
Language translator convert ______________ code to _______________ code.

1.Source, Object

2.Object, Source

3.Machine , Source

4.None of the above


Question:
Multiline string in python can be created by enclosing text in ____

1.Single quotes(‘ ‘)

2.Double quotes(” “)

3.Triple quotes(”’ ”’)

4.All the above


Question:
Operators work on values called ___

1.Operating

2.Operand

3.data value

4.Opvalue


Question:
Out of addition(+) and Subtraction (-) operator, which has more precedence?

1.Addition (+)

2. Subtraction (-)

3.Both have same precedence

4.None of the above


Question:
Output of print(2 * 3 ** 2) is

1.16

2.64

3.18

4.Error


Question:
print(3 != 4) will evaluates __

1.True

2.False

3.Error

4.None of the above


Question:
print(bool(3 and 6)) evaluates to __

1.False

2.True

3.Error

4.None of the above


Question:
print(bool(True and True or False)) evaluates to ___

1.False

2.True

3.Error

4.None of the above


Question:
Python uses ____ to convert its instructions into machine language.

1.Interpreter

2.Compiler

3.Both of the above

4.None of the above


Question:
Statement x += y is equivalent to ______

1.x = x + y

2.x = x * y

3.y = x + y

4.y = y * x


Question:
The smallest individual unit in a program is known as _

1.Token

2.Punctuators

3.Literals

4.Operators


Question:
Variables of data types like integers, float etc., hold __

1.single value

2.multiple values

3.exact 2 values

4.None of the above


Question:
Variables whose values can be changed after they are created and assigned are called __

1.mutable

2.immutable

3.changeable

4.None of the above


Question:
What is the return type of function id( )?

1.float

2.string

3.int

4.None of the above


Question:
Which escape sequence represent newline character?

1.

2. e

3.

4. T


Question:
Which of the following is a sequence data type?

1.String

2. Integer

3.Float

4.Dictionary


Question:
Which of the following is an assignment operator?

1.=

2./=

3.*=

4.All the above


Question:
Which of the following is an invalid relational operator in Python?

1.!=

2.==

3.>=

4.<>


Question:
Which of the following is invalid data type in python?

1.List

2.String

3.tuple

4.values


Question:
Which of the following is invalid logical operator?

1. and

2.or

3.not

4.xor


Question:
Which of the following is mapping data type in Python?

1.String

2.List

3.Dictionary

4.Tuple


Question:
Which of the following is not correct for naming an identifier in Python?

1.Identifier can be of any length

2.Identifier should not be a keyword

3.We cannot use special symbols like !, @, #, $, %, etc., in identifiers

4.Spaces are allowed in identifiers


Question:
Which of the following is not the feature of python language?

1.Python is a proprietary software.

2.Python is not case-sensitive.

3. Python uses brackets for blocks and nested blocks.

4.All the above


Question:
Which of the following is number data type in python?

1.Integer

2.Complex

3.Boolean

4.All the above


Question:
Which of the following is String literal?

1.ABC

2.123”

3.Both of the above

4.None of the above


Question:
Which of the following is token in Python?

1.Punctuators

2.Literals

3.Keywords

4.All the above


Question:
Which of the following statement display “RAM” two times?

1.>>> “RAM” + 2

2.>>> “RAM” * 2

3.>>> “RAM” ** 2

4.None of the above


Question:
Which of the following statement will return error when x = 7 ?

1.print(x)

2.print(int(x))

3. print(eval(x)

4.None of the above


Question:
Which of the following store data in pair?

1.List

2.Tuple

3.String

4.Dictionary


Question:
Which operator returns remainder?

1. /

2.//

3.%

4. \


Question:
Write the output of the following :
>>> a = 'India'
>>> a *= 3
>>> a

1.IndiaIndiaIndia

2.India3

3.3India

4.None of the above


Question:
Write the output of the following :
>>> num1 = 7
>>> num2 = 3
>>> num1 //= num2
>>> num1

1.3

2.7

3.2

4.8


Question:
Write the output of the following:
>>> 7 % 3 ** 3

1.1

2.7

3.3

4.27


Question:
________ are reserved words.

1.Keywords

2. Identifiers

3.Variables

4.Comments


Question:
_________ is a set of valid characters that a language can recognize.

1.identifier

2.Token

3.Character set

4.Character group


Question:
__________ operators are used to check if a value is a member of the given sequence or not.

1.Logical

2.Identity

3.Membership

4.Relational


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
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite 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!