top of page
Writer's pictureRajesh Singh

Python Jan 2023 Exam Solved Paper

1. Which of the following is not a control structure?

A. Loop

B. Process

C. Decision.

D. None of these

Answer: ()

2. For performing the addition of two numbers, which of the following symbol in a flow chart are used?

A. Control flow

B. Terminal

C. Processing

D Decision

Answer: ()

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

A. factorial()

B. print()

C. Seed()

D. Sqrt()

Answer: ()

4. NumPY stands for:

A. Numbering python

B. Number in python

C. Numerical python

D. None of the above

Answer: ()

5. Which symbol in used as a flowline to connect two blocks in a flow chart?

A. arrow

B. circle

C. box

D.parallelogram

Answer: ()

6. choose the correct function declaration of fun1() so that we can execute the following two function calls successfully.

fun1(25,75,55)

fun1(10,20)

A. def fun1(**kwargs)

B. def fun1(args*)

C. No, it is not possible in python

D.def fun1(*data)

Answer:()

7. which of he following symbols is used to represent output in a flow chart ?

A. square

B. circle

C. Parallelogram

D.Triangle

Answer: ()

8. Which statement will return one line from a file (file object is ‘f’) ?

A. f.readlines()

B. f.readline()

C. f.read()

D. f.line()

Answer: ()

9. ______Function returns the current position of file pointer.

A. get()

B. tell()

C. seek()

D. cur()

Answer: ()

10. What is the output of the following code snippet ?

print([i.lower () for i in“HELLO”])

A. hello

B. [‘h’,’e’,’l’,’l’,’o’]

C. hel

D.HELLO

Answer: ()

11. Structured program can be broken into_______to assign to more than one developer.

A. segments

B. modules

C. units

D.All the above

Answer: ()

12. What will be the output of the following pseudo code ?

Integer a,b

Set a=10,b=5

a=a mod (a-6)

b=b mod (b-2)

print a-b

A. 4

B. 0

C. 1

D. 8

Answer: ()

13. What does readlines() method return ?

A. Dictionary

B. String

C. Tuple

D.List

Answer: ()

14. What will be the output of the following pseudo code, where & represent and operation ?

Integer a,b,c

Set b=5, a=1

C=a&b

print c

A. 1

B. 3

C. 5

D.7

Answer: ()

15. What is the output of the following code?

import numpy as np

a=np.array([1,2,3,5,8])

b=np.array([ 0,3,4,2,1])

c=a+b

c=c*a

print(c[2])

A. 10

B. 21

C. 12

D.21

Answer: ()

16. What is the output of the following code?

import numpy as np

a=np.array([[1,2,3],[4,5,6]])

print(a.shape)]

A. (2,3)

B. (3,2)

C. (1,1)

D. None of these

Answer: ()

17. What is ‘f’ in the following statement?

f=open(“Data.txt”,”r”)

A. File name

B. File handle

C. Mode of file

D.file handling

Answer: ()

18. python supports the creation of anonymous functions at runtime, using a construct called______.

A. pi

B. anonymous

C. lambda

D.none of the above

Answer: ()

19. what is the output of the following code ?

M=[‘b’*x for x in range(4)]

print(M)

A. [“,’b’,’bb’,’bbb’]

B. [‘b’,’bb’,’bbb’,’bbbbb’]

C. [‘b’,’bb’,’bbb’]

D.none of these

Answer: ()

20. what is the output of the following code ?

import numpy as np

a=np.array([1,2,3,])

print(a.ndim)

A. 1

B. 2

C. 3

D.0

Answer: ()

21. The brain of computer system is________.

A. RAM

B. CPU

C. ROM

D.Control Unit

Answer: ()

22. Which of the following is a valid arithmetic operator in Python ?

A. //

B. ?

C. <

D.and

Answer: ()

23. what will be output for the following code ?

import numpy as np

a=np.array([[1,2,3],[0,1,4]])

A. 1

B. 5

C. 6

D.4

Answer: ()

24. The sequence logic will not be used while________.

A. Subtracting two numbers

B. Comparing two data values

C. providing output to the user

D.adding two numbers

Answer: ()

25. what will be the output of following code ?

Y=[2,5j,6]

Y.sort()

A. [2,6,5]

B. [5j,2,6]

C. Error

D.[6,5j,2]

Answer: ()

26. Which function is used to write data in binary mode ?

A. write

B. writelines

C. dump

D.pickly

Answer: ()

27. To use a module in another module,you must import it using an____statement.

A. import

B. include

C. Both(A)and(B)

D.None of the above

Answer: ()

28. Which of the following declarations is incorrect ?

A. _x=2

B. x=3

C. _xyz_=5

D.None of these

Answer: ()

29. A_____statement is used when a statement is required syntactically but you do not want any code to execute.

A. break

B. pass

C. continue

D.None of these

Answer: ()

30. What is a variable defined outside a function referred to as ?

A. A static variable

B. A global variable

C. A local varible

D.An automatic variable

Answer: ()

31. Kite/diamond symbol in flow chart is used for________.

A. execution

B. Decision

C. Statement

D.All of the above

Answer: ()

32. What is the datatype of x ?

Import numpy as np

a=np.array([1,2,3,4])

x=a.tolist()

A. int

B. array

C. tuple

D.list

Answer: ()

33. f.read(5) will read____from a file (file object ‘f’).

A. 5 characters

B. 5 words

C. 5 lines

D.None of the above

Answer: ()

34. Whar will be the output of the following python code ?

>>>list1=[1,3]

>>>list2=list1

>>>list1[0]=4

>>>print(list2)

A. [1,4]

B. [1,3,4]

C. [4,3]

D.[1,3]

Answer:()

35. What will be the output of following statement ?

>>>”m”+”nl”

A. ‘m+nl’

B. ‘mnl’

C. ‘m nl’

D.‘m’

Answer:()

36. Choose the correct option with respect to Python.

A. Both tuples and lists are immutable

B. Tuples are immutable while lists are mutable

C. Both tuples and lists are mutable

D.Tuples are mutable while lists are immutable

Answer:()

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

d={3,4,5}

for k in d:

print(k)

A. {3,4,5},{3,4,5},{3,4,5}

B. 3 4 5

C. syntax

D. None of the above

Answer: ()

38. Flow charts and Algorithms are used for_______.

A. Better Programming

B. Optimized Coding

C. Systematic testing

D. All the above

Answer: ()

39. A_____stores information in the form of a stream of ASCII or unicode characters i.e. human readable.

A. Text file

B. Binary file

C. Both(A)and(B)

D. None of these

Answer:()

40. What will following code segment print ?

if True or True:

if False and True or False:

print(‘A’)

elif False and False or True and True:

print(‘B’)

else:

print(‘C’)

else:

print(‘D’)

A. A

B. B

C. C

D. D

Answer: ()

41. In python language, which of the following operators is the correct option for raising k to the power 1 ?

A. k^1

B. k**1

C. k^^1

D. k^*1

Answer: ()

42. What will be the output of the following python code ?

example=”hello”

example.rfind(“e”)

A. 1

B. 2

C. 4

D. 5

Answer: ()

43. Which of the following is not an advantage of using modules ?

A. Provides a means of reuse of program code

B. Provides a means of dividing up tasks

C. Provides a means of reducing the size of the program

D. Provides a means of testing individual parts of the program

Answer:(C)

44. What is the ouput of following Python code ?

>>>print(5*(2//3))

A. 3

B. 3.3

C. 0

D. error

Answer: (C)

45. What will be ouput of the following code ?

import numpy as np

a=np.array([1,2,3,5,8])

print(a.ndim)

A. 0

B. 1

C. 2

D. 3

Answer: (B)

46. Which of the following are valid string manipulation functions in Python ?

A. Count()

B. Upper()

C. Strip()

D.All of the above

Answer: (D)

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

from math import*

floor(11.7)

A. 12

B. 11

C. 11.0

D.None of these

Answer: (B)

48. Which statement will move file pointer 10 bytes backward from current position ?

A. f.seek(-10,0)

B. f.seek(10,0)

C. f.seek(-10,1)

D.None of the above

Answer: (C)

49. Which of the following error is returned when we try to open a file in write mode which does not exist ?

A. File Found Error

B. File Not Exist Error

C. File Not found Error

D.None of the above

Answer: (D)

50. What will be the output of the following algorithm for a=5,b=8,c=6 ?

Step 1: Start

Step 2: Declare variables a,b and c.

Step 3: Read variables a,b and c.

Step 4: If a<b

If a<c

Display a is the smallest number.

Else

Display c is the smallest number.

Else

If b<c

Display b is the smallest number.

Else

Display c is the smallest number.

Step 5: Stop

A. a is the smallest number

B. b is the smallest number

C. c is the smallest number

D.Stop

Answer: (A)

51. Which of the following error is returned by the given code ?

>>>f=open(“test.txt”,”w”)

>>>f.write(345)

A. Syntax Error

B. Type Error

C. String Error

D.Run Time Error

Answer: ()

52. In which format Binary file contains information ?

A. Quick response code

B. Same format in which the data is held in memory

C. ASCII format

D. Unicode format

Answer: ()

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

from math import factorial

print(math.factorial(5))

A. 120

B. Nothing is printed

C. Error, method factorial doesn’t exist in math modules

D.Error, the statement should be print(factorial(5))

Answer: ()

54. Which of the following words is not a keyword of python language ?

A. val

B. raise

C. try

D. with

Answer: ()

55. which function is used to add an element (5) in the list ?

A. List1.sum(5)

B. List1.add(5)

C. List1.append(5)

D.List1.addelement(5)

Answer: (C)

56. What is the output of the following ?

y = ‘klmn’

for i in range(len(y)):

print(y)

A. klmn klmn klmn klmn

B. K

C. K k k

D.None of the these

Answer: ()

57. Which of the following software is required to run the hardware ?

A. Task Manager

B. Task bar

C. Program Manager

D.Device Driver

Answer: ()

58. In which of the following, data is stored permanently ?

A. Variable

B. File

C. Both of the above

D.None of the above

Answer: ()

59. In which software development phase quality of software is documented ?

A. Testing

B. Delivery

C. Idea

D.Development

Answer: ()

60. What is the use of the zeros() function in Numpy array in python ?

A. To make a Matrix with all element 0.

B. To make a Matrix with all diagonal element 0.

C. To make a Matrix with first row 0.

D.None of the above

Answer: ()

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

x = ‘abcd’

for i in x:

print(i.upper())

A. a B C D

B. a b c d

C. error

D.A B C D

Answer: ()

62. Recursive function is_______.

A. A function that calls itself

B. A function that calls other functions

C. Both(A)and(B)

D.None of the above

Answer: ()

63. Which mode creates a new file if the file does not exist ?

A. write mode

B. read mode

C. append mode

D.Both(A)and(C)

Answer: (D)

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

from math import*

a = 2.19

b = 3.999999

C = -3.30

print(int(a),floor(b),ceil(c),fabs(c))

A. 2 3 -3 3.3

B. 3 4 -3 3

C. 2 3 -3 3

D.2 3 -3 -3.3

Answer: ()

65. What type of data is : arr = [(1,1),(2,2),(3,3)] ?

A. List of tuples

B. Tuples of lists

C. Array of tuples

D.Invalid type

Answer: ()

66. In python language, which of the following cannot be defined as variable ?

A. _val

B. val

C. try

D._try_

Answer: ()

67. What will be the output for the following code ?

import numpy as np

ary = np.array([1,2,3,5,8])

ary = ary+1

print(ary[1])

A. 0

B. 1

C. 2

D.3

Answer: (D)

68. What is the output of the following code ?

a = set(‘abc’)

b = set(‘cdef’)

print(a&b)

A. {‘c’}

B. {‘a’,’b’,’c’,’d’,’e’,’f’}

C. {c}

D.None of these

Answer: ()

69. Which of the following will delete key-value pair for key=”tiger” in dictionary ?

dic={“lion”:”wild”,”tiger”:”wild”,”cat”:”domestic”,”dog”.”domestic”}

A. del dic[“tiger”]

B. dic[“tiger”].delete()

C. Delete(dic.[“tiger”])

D.Del(dic.[“tiger”])

Answer: ()

70. What is the value of the following Python code ?

>>>print(36/4)

A. 9

B. 4

C. 9.0

D.4.0

Answer: ()

71. Debugging is the process of fixing a_____in the software.

A. procedure

B. function

C. bug

D.None of these

Answer: ()

72. What will be the output of the following ?

print(sum(1,2,3))

A. Error

B. 6

C. 1

D.3

Answer: ()

73. What is the output of the following ?

n = 5

while n>0:

n- = 1

if n == 2:

continue

print(n)

A. 5 4 3 1 0

B. 4 3 1 0

C. 4 3 2

D.None of these

Answer: ()

74. What is the output of the following ?

print(max([1,2,3,4],[4,5,6],[7]))

A. [4,5,6]

B. [7]

C. [1,2,3,4]

D.7

Answer: ()

75. Pictorial representation of an algorithm is called as________.

A. statement

B. Program

C. Flow chart

D.All of the above

Answer: ()

76. Which statement is correct to import all modules from the package ?

A. from package import all

B. from package import *

C. from package include all

D.from package include *

Answer:(B)

77. what is the output of the following ?

m = 0

while m<5:

print(m)

m +=1

if m == 3:

break

else:

print(o)

A. 0 1 2 0

B. 0 1 2

C. 0 0 1 0 2

D.Error

Answer: ()

78. When we open file in append mode the file pointer is at the_____of the file.

A. anywhere in between the file

B. end

C. beginning

D. second line of the file

Answer:()

79. What will be the output of the following expression ?

x = 14

print(x>>2)

A. 14

B. 1

C. 3

D. 2

Answer: ()

80. The contents inside the “for loop” are separated by:

A. colon

B. comma

C. semicolon

D.hyphen

Answer: ()

81. what is the output of the following code ?

def s(n)1:

print(n1)

n1 = n1 +2

n2 = 4

s(n2)

print(n2)

A. 6 4

B. 4 6

C. 4 4

D.66

Answer: ()

82. Which one of the following is immutable data type ?

A. list

B. set

C. tuple

D.dict

Answer: ()

83. what will be the output of the following Python code ?

def func(a, b=5,c=10):

print(‘a is’,a,’and b is’,b,’and c is’,c)

func(13,17)

func(a=2,c=4)

func(5,7,9)

A. a is 13 and b is 15 and c is 10

a is 2 and b is 5 and c is 4

a is 5 and b is 7 and c is 9

B. a is 13 and b is 17 and c is 10

a is 2 and b is 4 and c is 4

a is 5 and b is 9 and c is 7

C. a is 13 and b is 17 and c is 10

a is 2 and b is 5 and c is 4

a is 5 and b is 7 and c is 9

D. None of the above

Answer: ()

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

Numbers = (4,7,19,2,89,45,72,22)

sorted_numbers = sorted(numbers)

odd_numbers = [x for x in sorted_numbers if x % 2 ! = 0]

print(odd_numbers)

A. [7,19,45,89]

B. [2,4,22,72]

C. [4,7,19,2,89,45,72,22]

D.[2,4,7,19,22,45,72,89]

Answer: ()

85. Which of the following is used to defind a block of code in Python language?

A. try

B. Brackets

C. Indentation

D.Catch

Answer: ()

86. Which of the following will read entire content of file (file objet’f’) ?

A. f.reads()

B. f.read()

C. f.read(all)

D.f.read(*)

Answer: ()

87. the connector symbol for flow chart is______.

A. Circle

B. Parallelogram

C. Diamond

D.All of the above

Answer: ()

88. Python is written in________.

A. Java

B. C

C. PHP

D.All of the above

Answer: ()

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

d1=[“abc”:5,”def”:6”ghi”:7]

print(d1[0])

A. abc

B. 5

C. {“abc”:5}

D. Error

Answer:(D)

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

len([“hello”,2,4,6])

A. Error

B. 6

C. 4

D.3

Answer: ()

91. The correct extension of the python file is________.

A. .py

B. .pyth

C. .python

D.None of these

Answer: ()

92. What will be the output of the following python code ?

def display(b,n):

while n>0:

print(b,end = ” ”)

n = n-1

display(‘z’,3)

A. zzz

B. zz

C. Infinite loop

D.An exception is thrown

Answer: ()

93. What will be output for the following code ?

import numpy as np

a = np.array([2,3,4,5])

print(a.dtype)

A. int 32

B. int

C. float

D.None of these

Answer: ()

94. Given a string x = “hello” what is the output of x.count(‘1’) ?

A. 2

B. 1

C. 0

D.none

Answer: ()

95. A detailed flow chart is called as___________.

A. stack

B. macro

C. micro

D.union

Answer: ()

96. Which translator is used to convert assembly language into machine langauge ?

A. Compiler

B. Interpreter

C. Assembler

D.None of these

Answer: ()

97. What is the output of the following ?

x = 123

for i in x:

print(i)

A. 1 2 3

B. 123

C. Error

D.None of these

Answer: ()

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

tuple1 = (5,1,7,6,2)

tuple1.pop(2)

print(tuple1)

A. (5,1,6,2)

B. (5,1,7,6)

C. (5,1,7,6,2)

D.Error

Answer: ()

99. Hierarchy in a pseudo-code can be shown by:

A. Curly braces

B. Round Brackets

C. Indentation

D.Semicolon

Answer: ()

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

def power(x,y=2):

r =2

for i in range(y):

r=r*x

return r

print(power(3))

print(power(3,3))

A. 212

32

B. 9

27

C. 567

98

D.None of the above

Answer: ()

















173 views0 comments

Recent Posts

See All

IT Tools and Network Basics MCQ

Q1. Presentation file created in LibreOffice Impress is saved with the extension….   लिब्रे ऑफिस इंप्रेस में बनाई गई प्रेजेंटेशन फ़ाइल...

For Loop MCQs in Python

Q1. What is the output of the following Python code? x={1:"X",2:"Y",3:"Z"} for i,j in x.items():     print(i,j,end=" ") A.    1 X 2 Y 3 Z...

Comentarios


bottom of page