0% found this document useful (0 votes)
20 views

ITI COPA Python MCQ

This document contains a series of important questions and answers related to Python programming, covering topics such as data types, functions, loops, and exception handling. Each question is presented with multiple-choice answers, and the correct answer is indicated. The content serves as a study guide for individuals preparing for ITI COPA assessments in Python.

Uploaded by

Mahesh Meravi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

ITI COPA Python MCQ

This document contains a series of important questions and answers related to Python programming, covering topics such as data types, functions, loops, and exception handling. Each question is presented with multiple-choice answers, and the correct answer is indicated. The content serves as a study guide for individuals preparing for ITI COPA assessments in Python.

Uploaded by

Mahesh Meravi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

ITI COPA Python Most important Question

1. Is Python code compiled or interpreted?


a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted
Ans. a

2. What does pip stand for python?


a) Pip Installs Python
b) Pip Installs Packages
c) Preferred Installer Program
d) All of the mentioned
Ans. c

3. What will be the output of the following Python function?


min(max(False,-3,-4), 2,7)
a) -4
b) -3
c) 2
d) False
Ans. d

4. What are the two main types of functions in Python?


a) System function
b) Custom function
c) Built-in function & User defined function
d) User function
Ans. c

5. Is Python case sensitive when dealing with identifiers?


a) No
b) Yes
c) Machine dependent
d) None of these
Ans. b

6. Which of the following functions can help us to find the version of python that we are currently working
on?
a) sys.version(1) b) sys.version(0)
c) sys.version() d) sys.version
Ans. d
7. Python supports the creation of anonymous functions at runtime, using construct called ____
a) pi b) anonymous c) lambda d) none of these
Ans. c

8. What is the order of precedence in python?


a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Division, Subtraction, Addition
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
Ans. d

9. Which of the following is true for variable names in Python?


a) underscore and ampersand are the only two special characters allowed
b) unlimited length
c) all private members must have leading and trailing underscores
d) none of the mentioned
Ans. b

10. Which of the following is the use of id() function in python?


a) Every object doesn’t have a unique id
b) Id returns the identity of the object
c) All of the mentioned
d) None of the mentioned
Ans. b

11. Which of the following is not a core data type in Python programming?
a) Tuples
b) Lists
c) Class
d) Dictionary
Ans. c

12. Which of these is the definition for packages in Python?


a) A set of main modules
b) A folder of python modules
c) A number of files containing Python definitions and statements
d) A set of programs making use of Python modules
Ans. b

13. What will be the output of the following Python function?


len(["hello",2, 4, 6])
a) Error b) 6 c) 4 d) 3
Answer: c Explanation: The function len() returns the length of the number of elements in the iterable.
Therefore the output of the function shown above is 4.
14. What is the order of namespaces in which Python looks for an identifier?
a) Python first searches the built-in namespace, then the global namespace and finally the local namespace
b) Python first searches the built-in namespace, then the local namespace and finally the global namespace
c) Python first searches the local namespace, then the global namespace and finally the built-in namespace
d) Python first searches the global namespace, then the local namespace and finally the built-in namespace
Ans. c

15. Which one of the following is not a keyword in Python language?


a) pass b) eval c) assert d) nonlocal
Ans. b

16. Which module in the python standard library parses options received from the command line?
a) getarg b) getopt c) main d) os
Ans. b

17. Which of the following statements is used to create an empty set in Python?
a) ( ) b) [ ] c) { } d) set()
Ans. d

18. To add a new element to a list we use which Python command?


a) list1.addEnd(5) b) list1.addLast(5)
c) list1.append(5) d) list1.add(5)
Ans. c

19. Which one of the following is the use of function in python?


a) Functions don’t provide better modularity for your application
b) you can’t also create your own functions
c) Functions are reusable pieces of programs
d) All of the mentioned
Ans. c

20. What will be the output of the following Python code?


x = 'abcd'
for i in range(len(x)):
print(i)
a) error b) 1 2 3 4 c) a b c d d) 0 1 2 3
Ans. d

21. Which of the following is a Python tuple?


a) {1, 2, 3}
b) {}
c) [1, 2, 3]
d) (1, 2, 3)
Ans. d Explanation: Tuples are represented with round brackets.
22. What will be the output of the following Python expression?
round(4.576)
a) 4 b) 4.6 c) 5 d) 4.5
Answer: c
Explanation: This is a built-in function which rounds a number to give precision in decimal digits. In the
above case, since the number of decimal places has not been specified, the decimal number is rounded off
to a whole number. Hence the output will be 5.

23. Which of the following is a feature of Python DocString?


a) In Python all functions should have a docstring
b) Docstrings can be accessed by the __doc__ attribute on objects
c) It provides a convenient way of associating documentation with Python modules, functions, classes, and
methods
d) All of the mentioned
Ans. d

24. What is output of print(math.pow(3, 2))?


a) 9.0 b) None c) 9 d) None of the mentioned
Answer: a
Explanation: math.pow() returns a floating point number.

25. The process of pickling in Python includes ____________


a) conversion of a Python object hierarchy into byte stream
b) conversion of a datatable into a list
c) conversion of a byte stream into Python object hierarchy
d) conversion of a list into a datatable
Answer: a
Explanation: Pickling is the process of serializing a Python object, that is, conversion of a Python object
hierarchy into a byte stream. The reverse of this process is known as unpickling.

26. What is the maximum length of a Python identifier?


a) 32
b) 16
c) 128
d) No fixed length is specified
Ans. d

27. Which of the following concepts is not a part of Python?


a) Pointers
b) Loops
c) Dynamic Typing
d) All of these
Ans. a
28. Which of the following statements are used in Exception Handling in Python?
a) try b) except c) finally d) All of these
Ans. d

29. Which of the following types of loops are not supported in Python?
a) for b) while c) do-while d) None of these
Ans. c

30. Which of the following is the proper syntax to check if a particular element is present in a list?
a) if ele in list
b) if not ele not in list
c) Both A and B
d) None of these
Ans. c

31. What will be the output of the following code snippet?


a = [1, 2]
print(a * 3)
a) Error
b) [1, 2]
c) [1, 2, 1, 2]
d) 1, 2, 1, 2, 1, 2]
Ans. d

32. What will be the output of the following code snippet?


example = ["Sunday", "Monday", "Tuesday", "Wednesday"];
del example[2]
print(example)
a) [‘Sunday’, ‘Monday’, ‘Tuesday’, ‘Wednesday’]
b) [‘Sunday’, ‘Monday’, ‘Wednesday’]
c) [‘Monday’, ‘Tuesday’, ‘Wednesday’]
d) [‘Sunday’, ‘Monday’, ‘Tuesday’]
Ans. b

33. What will be the type of the variable sorted_numbers in the below code snippet?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
print(sorted_numbers)
a) List
b) Tuple
c) String
d) Int
Ans. a
Explanation: sorted() function returns a list that contains all the elements in parameters in sorted order.
34. What will be the output of the following code snippet?
s = {1, 2, 3, 3, 2, 4, 5, 5}
print(s)
a) {1, 2, 3, 3, 2, 4, 5, 5}
b) [1, 2, 3, 4, 5}
c) {1, 5}
d) None of these
Ans. b
Explanation: Sets in python store only unique elements within them, without any repetition.

35. Which of the following functions converts date to corresponding time in Python?
a) strptime() b) strftime() c) Both A and B d) None of these
Ans. a

36. As what datatype are the *args stored, when passed into a function?
a) List b) Tuple c) Dictionary d) None of these
Ans. b

37. As what datatype are the *kwargs stored, when passed into a function?
a) Lists
b) Tuples
c) Dictionary
d) None of these
Ans. c

38. Which of the following blocks will always be executed whether an exception is encountered or not in a
program?
a) try
b) except
c) finally
d) None of these
Ans. c

39. What keyword is used in Python to raise exceptions?


a) raise
b) try
c) goto
d) except
Ans. a

40. Which of the following are valid escape sequences in Python?


a) \n b) \t c) \\ d) All of these
Ans. d
41. Which of the following are valid string manipulation functions in Python?
a) count() b) upper() c) strip() d) All of these
Ans. d

42. Which of the following modules need to be imported to handle date time computations in Python?
a) datetime
b) date
c) time
d) timedate
Ans. a

43. In which language is Python written?


a) C++
b) C
c) Java
d) None of these
Ans. b

44. In which year was the Python language developed?


a) 1995
b) 1972
c) 1981
d) 1989
Ans. d

45. In which year was the Python 3.0 version developed?


a) 2008
b) 2000
c) 2010
d) 2005
Ans. a

46. Which of the following statements is correct regarding the object-oriented programming concept in
Python?
a) Class are real-world entities while objects are not real
b) Objects are real-world entities while classes are not real
c) Both objects are classes are real-world entities
d) All of the above
Ans. b

47. What is the method inside the class in python language?


a) Object b) Function c) Attribute d) Argument
Ans. b
48. Why does the name of local variables start with an underscore discouraged?
a) To identify the variable
b) It confuses the interpreter
c) It indicates a private variable of a class
d) None of these
Ans. c

49. Which of the following is not a keyword in Python language?


a) val
b) raise
c) try
d) with
Ans. a

50. Which one of the following has the same precedence level?
a) Division, Power, Multiplication, Addition and Subtraction
b) Division and Multiplication
c) Subtraction and Division
d) Power and Division
Ans. b

51. Which one of the following has the highest precedence in the expression?
a) Division
b) Subtraction
c) Power
d) Parentheses
Ans. d (PEMDAS similar to BODMAS)

52. Study the following function:


import math
abs(math.sqrt(36))
a) -6
b) 6
c) 6.0
d) Error
Ans. c

53. Python is a _____ object-oriented programming language?


a) Special purpose
b) General purpose
c) Medium level programming language
d) All of the above
Ans. b
54. Which of the following is the application areas of Python programming language?
a) Web Development
b) Game Development
c) Artificial Intelligence and Machine Learning
d) All of these
Ans. d

55. Which of the following is the Numeric Data types?


a) int b) float c) complex d) All of these
Ans. d

56. List, tuple and range are the _____ of Data types
a) Sequence Types
b) Binary types
c) Boolean types
d) None of these
Ans. a

57. Which of the following is the logical operators in Python?


a) and
b) or
c) not
d) All of these
Ans. d

58. What is the name of the operator ** in Python?


a) Exponentiation
b) Modulus
c) Floor division
d) None of these
Ans. a

59. The % operator returns the ______.


a) Quotient
b) Divisor
c) Remainder
d) None of these
Ans. c

60. Which of the following is the method of list?


a) append() b) extend()
c) insert() d) All of these
Ans. d
61. Python Dictionary is used to store the data in a _____ format.
a) Key value pair b) Group value pair
c) Select value pair d) None of these
Ans. a

62. Conditional statements are also known as _____ statements.


a) Decision making b) Array
c) List d) None of these
Ans. a

63. Which of the following is not used as conditional statement in Python?


a) switch
b) if ….. else
c) elif
d) None of these
Ans. a

64. In a Python program, nested if statements denotes


a) if statement inside another if statement
b) if statement outside the another if statement
c) Both A and B
d) None of these
Ans. a

65. In Python, the break and continue statements, together are called _____ statement.
a) Jump
b) goto
c) compound
d) None of these
Ans. b

66. Loops are known as _____ in programming.


a) Control flow statements
b) Conditional statements
c) Data structure statements
d) None of these
Ans. a

67. Which of the following is true about the while loop?


a) It continually executes the statements as long as the given condition is true
b) It first checks the condition and then jumps into the instructions
c) The loop stops running when the condition becomes fail, and control will move to the next line of code
d) All of these
Ans. d
68. A function is a group of related statements which designed specifically to perform a ______.
a) Write code b) Specific task
c) Create executable file d) None of these
Ans. b

69. Among which of the following is a function which does not have any name?
a) Del function
b) Show function
c) Lambda function
d) None of these
Ans. c

70. Which of the following is the key function used for the file handling in Python?
a) open() and close()
b) read() and write()
c) append()
d) All of the mentioned above
Ans. d

71. Which of the following is needed to pen an existing file?


a) filename
b) mode
c) Both A and B
d) None of these
Ans. c

72. The function file_object.close() is used to ____.


a) To open the existing file
b) To append in an opened file
c) To close an opened file
d) None of these
Ans. c

73. The seek() method is used to ______.


a) Saves the file in secondary storage
b) Position the file object at a particular position in a file
c) Deletes the file from secondary storage
d) None of these
Ans. b

74. Which of the following function is used to create a file and written data?
a) append() b) open()
c) close() d) None of these
Ans. b
75. The module Pickle is used to ____.
a) Serializing Python object structure
b) De-serializing Python object structure
c) Both A and B
d) None of these
Ans. c

76. A text file contains only textual information consisting of _____.


a) Alphabets b) Numbers c) Special symbols d) All of these
Ans. d

77. Which of the following is the invalid variable?


a. 1st_string
b. my_string_1
c. _
d. foo
Ans. a

78. The command used to start Python from the command prompt is _____.
a) execute python
b) python
c) py
d) run python
Ans. b

79. Python is a/an _____


a) Programming language
b) Web browser
c) Malware
d) Operating system
Ans. a

80. What does the name Python signify?


a) It is a snake
b) It is very difficult to use
c) Named after the British comedy group Monty Python
d) All of these
Ans. c

81. What are the people who specialize in Python called?


a) Pythonic b) Unpythonic
c) Monty Python d) Pythoniasts
Ans. d
82. All the keywords in Python are in ____
a) Lower case
b) Upper case
c) Capitalized
d) None of the above
Ans. d (Only True, False and None are capitalized and all the others in lower case.)

83. What is output of 33 == 33.0


a) False
b) True
c) 33
d) None of these
Ans. b

84. What symbol do you use to asses equality between two elemtns?
a) &&
b) =
c) ==
d) ||
Ans. c

85. What happens when you use the build-in function any() on a list?
a) The any() function will randomly return any item from the list
b) The any() function returns True if any item in the list evaluates True. Otherwise, it return False
c) The any() function takes as arguments the list to check inside, and the item to check for. If “any” of the
item in the list match the item to check for, the function returns True
d) The any() function returns a Boolean value that answers the question “Are there any items in this list?”
Ans. b

1. Who developed Python Programming Language?


a) Wick van Rossum
b) Rasmus Lerdorf
c) Guido van Rossum
d) Niene Stom

2. Which of the following is the correct extension of the Python file?


a) .python b) .pl c) .py d) .p

3. Which keyword is used for function in Python language?


a) Function b) def c) Fun d) Define

4. Which of the following functions is a built-in function in python?


a) factorial() b) print() c) seed() d) sqrt()
5. Which type of programming does Python support?
a) object-oriented programming b) structured programming
c) functional programming d) all of the above

6. Which of the following is used to define a block of code in Python language?


a) Indentation b) Key c) Brackets d) All of the above

7. Which of the following character is used to give single-line comments in Python?


a) // b) # c) ! d) /*

8. What arithmetic operators cannot be used with strings in Python?


a) * b) – c) + d) All of the mentioned

9. What will be the output of the following Python code?


print("abc. DEF".capitalize())
a) Abc. Def b) abc. Def c) Abc. Def d) ABC. DEF

10. What will be the output of the following Python program?


i=0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
a) error
b) 0 1 2 0
c) 0 1 2
d) none of these

Click here for Answers

COPA Best MCQ Book in Just Rs.19/-(New Syllabus)


https://bharatskills.in/copa-mcq-book-pdf/

HEETSON
Telegram https://t.me/Heetson_Official

WhatsApp Channel

@heetsoniti

You might also like