M3 R5 O Level Python July Answer Key 2022

O Level Python July  Answer Key 2022

O Level M3 R5 Python July 2022 solved paper | M3 R5 O Level Python July  answer key 2022

1. What is the return type of following function ?
  
    def fun1();
    return 'mnp', 22
    print(type(fun1())

A) List
B) dictionary
C) String
D) tuple

Ans: D) tuple    

2. What will be the output of the following pseudo-code?

integer a 
Set a=4
do 
print a+2
a=a-1
while (a not equals 0)
end while

A) 6666
B) 6543
C) 6789
D) 681012

Ans: B) 6543   

3.  How is a function declared in Python ?
A) def function function_name();
B) declare function function_name();
C) def function_name():
D) declare function_name();

Ans : C) def function_name():  

4.  Which of the following is an invalid mode ?
A) a
B) ar+
C) r+
D) w

Ans: B) ar+     

5. The syntax used to rename a file :
A) os.rename(exiting_name, new_name)
B) fp.name='name_name'
C) os.rename(fp, new_name)
D) os.set_name(exiting_name, new_name)

Ans : A) os.rename(exiting_name, new_name)   

6. What is the output of the following code?
   
     a = set('dcma')
    b = set('mlpc')
    print(a^b)

A) {'d','c'.'a','m','l','p','c'}
B) {'m','l','p','c'}
C) {'d','c','m','a'}
D) None of these

Ans : D) None of these   

7.  What is the output of the following code ?

    import numpy as np
    y=np.array([[11,12,13,14],[32,33,34,35]])
    print(y.ndim)

A) 1
B) 2
C) 3
D) 0

Ans : B) 2   

8. What does the following code print ?

x='mohan'
for in range (len(x)):
x[i].upper()
print (x)

A) mohan
B)  MOHAN
C)  error
D) None of these

Ans:

9. What will be the output of the following expresion ?
a=2
b=8
print(a|b)
print(a>>1)

A)10 0
B) 10 2
C)  2 2
D) 10 1

Ans :

10.  What is the function to read the remaining lines of the file from a file object infile ?
A) infile.read(2)
B)  infile.read()
C) infile.readlines()
D) infile.reading()

Ans:   

11. What will be the output after the following statements ?

a=0
b=3
while a+b<8:
a+=1
print(a,end=)

A) 0 1 2 3 4
B) 1 2 3 4 5 6
C) 1 2 3 4 5
D) None of these

Ans :

12. A process is expressed in a flowchart by _____?
A) Rectangle
B) A circle
C) Parallelogram
D) A diamond

Ans :

13 . Which of the following variable declaration is incorrect ?
A) a_=3
B) _a=3
C) a?=3
D) All of these

Ans :

14. The process of drawing a flowchart for an algorithm is called __________?
A) Performance
B) Algorithmic Representation
C) Evaluation
D) flowcharting

Ans :

15. Which symbol is used to write single line comment ?
A) *
B) #
C) /
D) ?

Ans: 

16. NumPY stands for?
A) Numbering Python
B) Number in Python
C) Numerical Python
D) Number for Python

Ans: 

17. What is the output of the following code?
    
    a={1:"A", 2: "B",3: "C"}
    b={14: "0", 5: "E"}
    a.update(b)

A) {1:'A', 2: 'B',3: 'C'}
B) (1: 'A', 2: 'B',3: 'C', 4: 'D',5: 'E')
C) Error
D) (4: 'D',5: 'E')
            
Ans: 

18. Which of the following is not a correct mode to open a file?
A) ab
B) rw
C) a+
D) r+

Ans: 

19. The process of finding errors in a code is called__________?
A) Compiling
B) Running
C) Testing
D) Debugging

Ans: 

20. What will be the output of the following code?
    
    f=open("demo.txt","w+")
    f.write=("Welcome to Python")
    f.seek(5)
    a=f.read(5)
    print(a)

A) Welco
B) me to
C) Welcome to Python
D) e to
            
Ans: 

Post a Comment

0 Comments