Skip to content

Programming and Problem Solving through Python (M3-R5.1)- NIELIT O Level

  • by

You Have 2 hours To Complete The Test / Quiz


Programming and Problem Solving through Python (M3-R5.1)

Total available questions is More than 1000.

Each exam has 100 questions & Answers randomly.

You will get 2 hrs to complete the test.

Its Mandatory To Fill For Get Certificate After Complete Exam.

1) Which one of the following is the correct extension of the Python file-

2) Which of the following is not a legal integer type value in python.

3) What will be the output of the following Python code?

  l=[1,2,3,4,5]  [x&1 for x in l]

4) The operator used to check if both the operands reference the same object memory, is the ………. operator.

5) The _____ function converts the specified value into a string.

6) To print the value of a variable, Python uses

7) The readlines() method reads and returns ______ .

8) ___ in Python is a counter-controlled loop.

9) The word comes form the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al khowarizami is a called?

10) In Python assignment of more than one behaviour to a particular function and the operation performed varies by the types of objects or arguments involved are known as_____ .

11) What is the syntax of the following Python code?

>>> a=frozenset(set([5,6,7]))  >>> a

12)

13) What is the data type of (1)?

14) (

What will be the output of the following Python code?

>>> a={5,4}  >>> b={1,2,4,5}  >>> a<b

 

15)

16) Which inbuilt function is used to takes an iterable object as input and makes them immutable.

17) What will be the output of the following Python code snippet?

print([[i+j for i in "abc"] for j in "def"])

18) What will be the output of the following Python code?

print('*', "abcdef".center(7), '*', sep='')

19) . What will be the output of the following Python code?

s1={3, 4}

  s2={1, 2}  s3=set()  i=0  j=0  for i in s1:      for j in s2:          s3.add((i,j))          i+=1          j+=1

print(s3)

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

  x = "abcdef"  i = "a"  while i in x:      x = x[1:]      print(i, end = " ")

 

21) What will be the output of the following Python code?

print("Hello {0} and {1}".format('foo', 'bin'))

22) Find the last element of list in Python? Assume ‘bikes’ is the name of list.

23) What will be the output of the following Python code?

matrix = [[1, 2, 3, 4],
         [4, 5, 6, 7],
         [8, 9, 10, 11],
         [12, 13, 14, 15]]  
for i in range(0, 4):
      print(matrix[i][1], end = " ")
24)

25) Which is Special type of literal in Python

26) The symbol used for both input and output is a _____ .

27) Which of the following is not a keyword?

28) Which one of the following has the highest precedence in the expression?

29) ____is a string literal denoted by triple quotes for providing the specifications of certain program elements.

30) What will be the output of the following Python code snippet?

{a**2 for a in range(4)}

31) What is the output of the following code?

list1=[2, 33, 222, 14, 25]
print(list1[ : -1 ])

32) Every function has an implicit statement _____ as the last instruction in the function body.

33) What will be the output of the following Python code?

print('*', "abcde".center(6), '*', sep='')

34) Which of the following declaration is incorrect?

35) Python supports Object-Oriented style or technique of programming that encapsulates code within _____.

36) Which of the following is not a valid keyword of Python associated with loops?

37) What will be the output of the following Python code snippet?

print('11'.isnumeric())

38) The datatype whose representation is unknown are called

39) Which one of the following has the same precedence level?

40) List structure in python where elements are stored in parenthesis.

41) What will be the output of the following Python code snippet?

for i in ''.join(reversed(list('abcd'))):      print (i)

42) What is the list comprehension equivalent for?

  {x : x is a whole number less than 20, x is even}    (including zero)

43) Strings in Python are _____

44) What will be the output of the following Python code?

print("abcdef".center(10, '12'))

45) What will be the output of the following Python code?

a=[13,56,17]
a.append([87])
a.extend([45,67])
print(a)

46) Which symbol is used as a flowline to connect two blocks in a flow chart?

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

  1. >>>t = (1, 2, 4, 3, 8, 9)
  2. >>>[t[i] for i in range(0, len(t), 2)]

 

48) Which function is used to Writes the string(s) to the file and returns the number of characters written.

49) elif can be considered to be abbreviation of

50) The process of drawing a flowchart for an algorithms is called

51) will return the mathematical number PI from the constants module.

52) What will be the output of the following Python code?

myList = [1, 5, 5, 5, 5, 1]
max = myList[0]
indexOfMax = 0
for i in range(1, len(myList)):
    if myList[i] > max:
        max = myList[i]
        indexOfMax = i   
print(indexOfMax)

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

>>> a=[(2,4),(1,2),(3,9)]  >>> a.sort()  >>> a

 

54) What will be the output of the following Python code?

x = ['ab', 'cd']  
for i in x:      
    x.append(i.upper())  
print(x)

55) In a flowchart an input or output instruction is represented by

56) Which of the following is an invalid variable?

57) What will be the value of p when p= int(17/2+11.5)?

58) Testing is known as

59) Which character is used in Python to make a single line comment?

60) What will be the output of the following Python code snippet?

z=set(‘abc’)

  z.add('san')  z.update(set(['p', 'q']))

z

61) is used for data analysis and manipulations in tabular data in Python.

62) Users write the programs in which language?

63) What will be the output of the following Python code?

>>> a={5,6,7,8}  >>> b={7,8,10,11}  >>> a^b

64) Suppose t=(1,2,4,3), which of the following is incorrect?

65) Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’]

  w="hello"  v=('a', 'e', 'i', 'o', 'u')

66) What will be the output of the following Python code?

s=set()

type(s)

67) Python programming language allows to use one loop inside another loop known as ?

68) What will be the output of the following Python code snippet?

print('1.1'.isnumeric())

69) What is the output of the expression : 3*1**3 ?

70) If we not see the rules of th programming language, we get ?

71) filter() is used to

72) What will be the output of the following Python code?

>>> a={4,5,6}  >>> b={2,8,6}  >>> a+b

73) Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9].

74) What will be the output of the following Python code?

True = False  while True:      print(True)      break

75) ______ method parses the expression passed to it and runs python expression(code) within the program.

76) The ______ statement lets the program go through the piece of code without performing any action.

77)
What is the output of the code print(7%2).

78) Write the list comprehension to pick out only negative integers from a given list ‘l’.

79) What will be the output of the following Python code?

    x = "abcdef"  while i in x:      print(i, end=" ")
80)
A natural number 1 is also an ______.

81) What will be the output of the following Python code?

>>> a=(2,3,4)  >>> sum(a,3)

82) What will be the output of the following Python code?

  x = (i for i in range(3))  for i in x:      print(i)

83) What is the output of the code print(7%2).

84) What will be the output of the following Python code?

>>> a=(1,2,(4,5))  >>> b=(1,2,(3,4))  >>> a<b

85) Given a function that does not return any value, what value is shown when executed at the shell ?

86) What is the output of the following program ? print 0.1+0.2==0.3

87) What will be the output of the following Python code snippet?

88) What will be the output of the following Python code?

  1.   numberGames = {}
  2.   numberGames[(1,2,4)] = 8
  3.   numberGames[(4,2,1)] = 10
  4.   numberGames[(1,2)] = 12
  5.   sum = 0
  6. for k in numberGames:
  7.       sum += numberGames[k]
  8.   print len(numberGames) + sum

89) What will be the output after the following statements?

for i in range(1,6):
    print(i, end='')
    if i == 3:
        break

91) Which of the following expressions results in an error?

92) What will be the output of the following Python statement?

>>>chr(ord('A'))

93) What will be the output of the following Python code?

values = [[3, 4, 5, 1 ], [33, 6, 1, 2]]
for row in values:
    row.sort()
    for element in row:
        print(element, end = " ")
    print()

94) What will be the output of the following Python code?

  s=["pune", "mumbai", "delhi"]  [(w.upper(), len(w)) for w in s]

95) When _____ gets executed, ‘inner PI value’ is printed as that is ‘pi’ value inside the function namespace.

96) In Python, we can use _______ operators for list objects.

97) ____ is the output you get when ‘2’==2 is executed

98)

99) What will be the output of the following Python code?

  num = ['One', 'Two', 'Three']  for i, x in enumerate(num):      print('{}: {}'.format(i, x),end=" ")

100) The contents inside the “for loop” are separated by?

Your score is

You cannot copy content of this page