0% found this document useful (0 votes)
24 views12 pages

Getting Started With Python - MCQ

The document consists of multiple-choice questions (MCQs) designed to test knowledge of Python programming concepts. Topics covered include programming definitions, data types, operators, error handling, and Python syntax. It serves as a study guide for beginners to assess their understanding of Python fundamentals.

Uploaded by

induvenkat123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views12 pages

Getting Started With Python - MCQ

The document consists of multiple-choice questions (MCQs) designed to test knowledge of Python programming concepts. Topics covered include programming definitions, data types, operators, error handling, and Python syntax. It serves as a study guide for beginners to assess their understanding of Python fundamentals.

Uploaded by

induvenkat123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Getting Started with Python - MCQ

1. An ordered set of instructions to be executed by a computer to carry out a specific


task is called a ___________.
a. Program
b. Instruction
c. Code
d. None of the above

2. Computers understand the language of 0s and 1s which is called__________.


a. Machine language
b. Low level language
c. Both a) and b)
d. None of the above

3. A program written in a high-level language is called _________.


a. Language
b. Source code
c. Machine code
d. None of the above

4. An interpreter read the program statements _________.


a. All the source at a time
b. One by one
c. Both a) and b)
d. None of the above

5. Python is a __________.
a. Low level language
b. High level language
c. Machine level language
d. All of the above

6. Python is __________.
a. Open source language
b. Free language
c. Both a) and b)
d. None of the above

7. Python support __________.


a. Compiler
b. Interpreter
c. Assembler
d. None of the above

8. Python programs are ___________.


a. Easy to understand
b. Clearly defined syntax
c. Relatively simple structure
d. All of the above

9. Python is _________.
a. Case – sensitive
b. Non case – sensitive
c. Both a) and b)
d. None of the above

10. Python is platform independent, meaning ___________.


a. It can run various operating systems
b. It can run various hardware platforms
c. Both a) and b)
d. None of the above

11. Python uses indentation for __________.


a. Blocks
b. Nested Blocks
c. Both a) and b)
d. None of the above

12. To write and run (execute) a Python program, we need to have a ___________.
a. Python interpreter installed on the computer
b. We can use any online python interpreter
c. Both a) and b)
d. None of the above

13. The interpreter is also called python _______.


a. Shell
b. Cell
c. Program
d. None of the above

14. To execute the python program we have to use __________.


a. Interactive mode
b. Script mode
c. Both a) and b)
d. None of the above

15. __________ allows execution of individual statements instantaneously.


a. Interactive mode
b. Script mode
c. Both a) and b)
d. None of the above

16. _________allows us to write more than one instruction in a file called Python
source code.
a. Interactive mode
b. Script mode
c. Both a) and b)
d. None of the above

17. To work in the interactive mode, we can simply type a Python statement on the
________ prompt directly.
a. >>>
b. >>
c. >
d. None of the above

18. In the script mode, we can write a Python program in a ________, save it and then
use the interpreter to execute it.
a. Prompt
b. File
c. Folder
d. All of the above

19. By default the python extension is __________.


a. .py
b. .ppy
c. .pp
d. .pyy

20. __________ are reserved words in python.


a. Keyword
b. Interpreter
c. Program
d. None of the above
21. The rules for naming an identifier in Python are ________.
a. Name should begin with an uppercase, lowercase or underscore
b. It can be of any length
c. It should not be a keyword
d. All of the above

22. To define variables in python _______ special symbols is not allowed.


a. @
b. # and !
c. $ and %
d. All of the above

23. A variable in a program is uniquely identified by a name __________.


a. Identifier
b. Keyword
c. Code
d. None of the above

24. Variable in python refers to an ________.


a. Keyword
b. Object
c. Alphabets
d. None of the above

25. The variable message holds string type value and so its content is assigned within
_________.
a. Double quotes “”
b. Single quotes ”
c. Both a) and b)
d. None of the above

26. _________ must always be assigned values before they are used in expressions.
a. Keyword
b. Variable
c. Code
d. None of the above

27. ___________ are used to add a remark or a note in the source code.
a. Keyword
b. Source
c. Comment
d. None of the above
28. __________ are not executed by a python interpreter.
a. Keyword
b. Source
c. Comment
d. None of the above

29. In python comments start from _______.


a. #
b. @
c. %
d. $

30. Python treats every value or data item whether numeric, string, or other type
(discussed in the next section) as an _________.
a. Object
b. Variable
c. Keyword
d. None of the above

31. _________ identifies the type of data values a variable can hold and the operations
that can be performed on that data.
a. Data type
b. Data base
c. Both a) and b)
d. None of the above

32. Number data type classified into ________.


a. int
b. float
c. complex
d. All of the above

33. ________ data type is a subtype of integer


a. Boolean
b. string
c. list
d. None of the above

34. A Python sequence is an ordered collection of items.


a. Number
b. Sequence
c. Both a) and b)
d. None of the above

35. Sequence data type is classified into _________.


a. Strings
b. Lists
c. Tuples
d. All of the above

36. __________ is a group of characters in python.


a. Number
b. String
c. Boolean
d. All of the above

37. In the string data type you can store __________.


a. Alphabets
b. Digits
c. Special character including space
d. All of the above

38. _________ is a sequence of items separated by commas and the items are enclosed
in square brackets [ ].
a. List
b. Tuple
c. String
d. None of the above

39. __________ is a sequence of items separated by commas and items are enclosed
in parenthesis ( ).
a. List
b. Tuple
c. String
d. None of the above

40. _________ is an unordered collection of items separated by commas and the items
are enclosed in curly brackets { }.
a. List
b. Set
c. String
d. None of the above
41. ________ data type cannot have duplicate entries.
a. List
b. Set
c. String
d. None of the above

42. None is a special data type with a single value. It is used to signify the absence of
value in a situation.
a. List
b. Set
c. String
d. None

43. ___________ in Python holds data items in key-value pairs.


a. Dictionary
b. Set
c. String
d. None

44. Items in a dictionary are enclosed in __________.


a. Parenthesis ()
b. Brackets []
c. Curly brackets {}
d. All of the above

45. In the dictionary every key is separated from its value using a _________.
a. Colon (:)
b. Semicolon (;)
c. Comma (,)
d. All of the above

46. Variables whose values can be changed after they are created and assigned are
called __________.
a. Immutable
b. Mutable
c. Both a) and b)
d. None of the above

47. Variables whose values cannot be changed after they are created and assigned are
called _________.
a. Immutable
b. Mutable
c. Both a) and b)
d. None of the above

48. When we need uniqueness of elements and to avoid duplicacy it is preferable to


use __________.
a. List
b. Set
c. Tuple
d. All of the above

[Link] values that the operators work on are called __________.


a. Operands
b. Assignment
c. Mathematical Operator
d. All of the above

50. ____________ that are used to perform the four basic arithmetic operations as
well as modular division, floor division and exponentiation.
a. Arithmetic Operator
b. Logical Operator
c. Relational Operator
d. All of the above

51. __________ calculation on operands. That is, raise the operand on the left to the
power of the operand on the right.
a. Floor Division (//)
b. Exponent (**)
c. Modulus (%)
d. None of the above

52. _____________ compares the values of the operands on either side and
determines the relationship among them.
a. Arithmetic Operator
b. Logical Operator
c. Relational Operator
d. All of the above

53. _________ assigns or changes the value of the variable on its left.
a. Relational Operator
b. Assignment Operator
c. Logical Operator
d. All of the above
54. Which one of the following logical operators is supported by python.
a. and
b. or
c. not
d. All of the above

55. _________ operator is used to check both the operands are true.
a. and
b. or
c. not
d. All of the above

56. ___________ are used to determine whether the value of a variable is of a certain
type or not.
a. Relational Operator
b. Logical Operator
c. Identity Operator
d. All of the above

57. ___________ can also be used to determine whether two variables are referring to
the same object or not.
a. Relational Operator
b. Logical Operator
c. Identity Operator
d. All of the above

58. Membership operators are used to check if a value is a member of the given
sequence or not.
a. Identity Operator
b. Membership Operators
c. Relational Operators
d. All of the above

59. An __________ is defined as a combination of constants, variables, and operators.


a. Expressions
b. Precedence
c. Both a) and b)
d. None of the above

60. Evaluation of the expression is based on __________ of operators.


a. Expressions
b. Precedence
c. Both a) and b)
d. None of the above

61. Example of membership operators.


a. in
b. not
c. in
d. All of the above

62. Example of identity operators.


a. is
b. is not
c. Both a) and b)
d. None of the above

63. In Python, we have the ____________ function for taking the user input.
a. prompt()
b. input()
c. in()
d. None of the above

64. In Python, we have the ___________ function for displaying the output.
a. prompt()
b. output()
c. print()
d. None of the above

65. ____________, also called type casting, happens when data type conversion takes
place because the programmer forced it in the program.
a. Explicit conversion
b. Implicit conversion
c. Both a) and b)
d. None of the above

66. __________, also known as coercion, happens when data type conversion is done
automatically by Python and is not instructed by the programmer.
a. Explicit conversion
b. Implicit conversion
c. Both a) and b)
d. None of the above
67. A programmer can make mistakes while writing a program, and hence, the
program may not execute or may generate wrong output. The process of identifying
and removing such mistakes, also known as __________.
a. Bugs
b. Errors
c. Both a) and b)
d. None of the above

68. Identifying and removing bugs or errors from the program is also known as
__________.
a. Debugging
b. Mistakes
c. Error
d. None of the above

69. Which of the following errors occur in python programs.


a. Syntax error
b. Logical error
c. Runtime error
d. All of the above

70. A _________ produces an undesired output but without abrupt termination of the
execution of the program.
a. Syntax error
b. Logical error
c. Runtime error
d. All of the above

71. A ___________ causes abnormal termination of the program while it is executing.


a. Syntax error
b. Logical error
c. Runtime error
d. All of the above

72. Python is __________ language that can be used for a multitude of scientific and
non-scientific computing purposes.
a. Open – source
b. High level
c. Interpreter – based
d. All of the above
73. Comments are __________ statements in a program.
a. Non – executable
b. Executable
c. Both a) and b)
d. None of the above

74. __________ is a user defined name given to a variable or a constant in a program.


a. Keyword
b. Identifier
c. Data type
d. All of the above

75. The process of identifying and removing errors from a computer program is called
_______.
a. Debugging
b. Mistakes
c. Error
d. None of the above

You might also like