top of page
Search

# Python Practice Set January 2023

Updated: Dec 31, 2022

1.

The output of the following code.

string=”my name is x”

for i in string:

print(i,end=”,”)

A. m,y,,n,a,m,e,,i,s,x,

B. m,y,,n,a,m,e,,i,s,x

C. my,name,is,x

D. None

2. What arithmetic cannot be used with strings?

A. +

B. *

C.

D. All of the mentioned

3. The output of the following code.

string=”my name is x”

for i in string.split():

print(i,end=”, ”)

A. m,y,,n,a,m,e,,i,s,,x,

B. m,y,,n,a,m,e,,I,s,,x

C. my,name,is,x,

D. Error

4. The output of the following code.

a=[0,1,2,3]

for a[-1] in a:

print(a[-1])

A. 0 1 2 3

B. 0 1 2 2

C. 3 3 3 3

D. error

5. The output of the following code.

a=[0,1,2,3]

for a  in a:

print(a)

A. 0 1 2 3

B. 0 1 2 2

C. 0 2 3 4

D.Error

6. The output of the following code.

a=[0,1,2,3]

i= -2

for i in not in a:

print(i)

i+=1

A. -2 -1

B. 0

C. Error

D.None of the mentioned

7. The output of the following code.

>>>”b”+”cde”

A. a

B. cde

C. bcd

D.Bcde

8. The output of the following code.

>>>”abcde”[3 :]

A. ab

B. de

C. cde

D.None

9. The output of the following code.

>>>print(‘new’ ‘line’)

A. error

B. output equialent to print ‘newline’

C. newline

D.new line

10. The output of the following code.

>>>max(“what are you”)

A. u

B. t

C. m

D.K

11. Which of the following statement prints helloexample test.txt?

A. print(“helloexample est.txt”)

B. print(“helloexample test.txt”)

C. print(“hello”example”test.txt”)

D.print(“hello”example “est.txt”)

12. The output of the following code.

print(“xyyzxyzxzxyy”.count(‘yy’))

A. 3

B. 0

C. 2

D.None

13. The output of the following code.

>>>str1=”helloworld”

>>>str1[: : -1]

A. dlrowolleh

B. Hello

C. world

D.Helloworld

14. what is the output of the below program in python:

print(0.2+0.4==0.6)

A. True

B. False

C. Error

D.Depends on machine

15. Which is not a feature of python language.

A. interpreted language

B. portable

C. high level language

D.case insensitive

16. Python is a …………object-oriented programming language.

A. Special purpose

B. General purpose

C. Medium level programming language

D.All of the mentioned above

17. Developer of python programming?

A. Denis Ritchie

B. Y.C Khenderakar

C. Tim Berner Lee

D.Guido van Rossum

18. Which are application areas of python programming?

A. Web development

B. Game development

C. Artificial intelligence and machine learning

D. All of the above

19. What is numeric types of data types?

A. int

B. Float

C. Complex

D.All of the above

20. What is the output for below code?

a = 2

b = 3

print(a,b)

a,b=b,a

print(a,b)

A. 23 23

B. 23 32

C. 32 32

D.None of above

21. List tuple dictionary are which types of datatypes?

A. Binary types

B. Boolean types

C. Sequence types

D.None of the above

22. Which keyword used in python language?

A. Finally

B. Lambda

C. While

D.All of above

23. Python Dictionary is used to store the data in.

A. Key value pair

B. Set value pair

C. Tuple value pair

D.None of the above

24. Which is invalid variable?

A. my_string_1

B. _

C. Foo

D.1st_string

25. What is the output of given code?

4+2**5//10

A. 77

B. 7

C. 3

D.0

26. The python language developed in which?

A. 1995

B. 1989

C. 1972

D.1981

27. Single line comment in python?

A. /

B. //

C. #

D.!

28. Conditional statements are also known as.

A. Decision-making

B. Array

C. List

D.Looping

29. Which is not used as Conditional statement in python?

A. switch

B. if…else

C. elif

D.For

30. which string represent the purpose for which the file is open?

A. “file name”

B. “file handle”

C. “file mode”

D.None of above

31. File handle is also know as.

A. File name

B. File variable

C. File object

D.none of above

32. which () finf the current position of file pointer with in file?

A. Seek()

B. Tell()

D.All of above

33. What is packing.

A. it is used for object serialization

B. It is used for object deserialization

C. All of the mentions

D.None of above

34. Eof standed for.

A. End of file

B. End of close

C. End of open

D.None of them

35. Input device.

B. Gps

C. Microphone

D.All of above

36. To reped the list up to a spacify a number of iteam. Which operater required?

A. +

B. *

C. :

D.None

37. What type of data is?

a=[(1,1),(2,5),(3,9)]

A. array of tuple

B. tuples of list

C. List of tuple

D.invalid list

38. What will be print?

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)

A. 7

B. 12

C. 10

D. 21

39. import numpy as np.

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

print(a.size)

A. 1

B. 5

C. 6

D. 4

40. import numpy as np

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

print(a.ndim)

A. 0

B. 1

C. 2

D. 3

41. Numpy stands for.

A. Numbering Python

B. Number in Python

C. Numerical Python

D. Number Python

42. numpy is used along with package like?

A. Node Js

B. Matplotlib

C. Scipy

D. Both(B)and(C)

43. the sets the size of the buffer used in ufuncs?

A. bufsize(size)

B.setsize(size)

C. set bufsize(size)

D. Size(size)

44. import numpy as np

dt=dt= np.dtype(‘i,4’)

print(dt)

A. int 32

B. int 64

C. int 128

D. int 16

45. if a dimension is given as _ in a reshaping operation, the other dimensions are Automate cally calculated.

A. Zero

B. One

C. Negative one

D. Infinite

46. Testing process first goal.

A. Testing

B. Analysis

C. Bug preventation

D. All of above

47. Sorting means.

A. Arranging the data

B. Processing the data

C. Calegrizing

D.None of above

48. Medium of comonunication.

A. Network

B. Compiler

C. Language

D.All of above

49. Bug means.

A. An insert in the program

B. Data input to the program

C. The error in the program

D.All of the above

50. Identifire maxium possible lenth.

A. 31 character

B. 63 character

C. 79 charater

D.None of the above

51. Which of the following is an invalid variable.

A. my_string_1

B. 5 st_string

C. Too

D.__

52. Which function do you use to read a string?

A. input(“enter a string”)

B. eval(input(“enter a string”))

C. enter(“enter a string”)

D.eval(enter(“enter a string”))

53. 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