STUDENT NAME:……………………………………………………… CLASS NUMBER:…………………….
1. What will be the expected output of the following python code?
a="rama"
print(type("rama"));
print(a);
Ans:…………………………………………………………….
2. What will be the expected output of the following python code:
a=786;
b=a;
print(a);
print(b);
print(id(a));
print(id(b));
Ans:…………………………………………………………….
3.Python Comments are written by using ………………..
4. Which of the following is the correct extension of the Python file?
a) .python
b) .pl
c) .py
d) .p
Ans:…………………………………………………..
5. What will be the output of the following python code:
b=45;
print("a"+b);
Ans:……………………………………………………
6.What will be the output of the following python code:
print("a"+"mmi");
Ans:…………………………………………………………..
7. What will be the output of the following Python Code:
print([(5>8)&(8<0),(6>3)|(3>0), not 3>1])
Ans:………………………………………………………….
8. Analyze the code and write the output for the following python code
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)
What will be the output of this statement?
a. 0 1
b. 0 1 2
c. 0 1 2 0
d. 0 1 2 3
Ans………………………………
9. What is the output of the following python code
‘9’ == 9 is executed?
a. False
b.True
c. ValEAns:……………………………………………………
10. Analyze the following statement
z = {“a”:0, “b”:1}
Which of the following is the correct statement?
a. a dictionary z is created
b. a and b are the keys of dictionary z
c. 0 and 1 are the values of dictionary z
d. All of the above
Answer: …………………………………….
11. Analyze the following program:
1. d = {0: ‘a’, 1: ‘b’, 2: ‘c’}
2. for i in d:
3. print(i)
What will be the output of this statement?
a. a b c
b. 0 1 2
c. 0 a 1 b 2 c
d. None of these above
Answer: ……………………………………….
12. L will be belongs to the which data type in python?
L = [2, 54, ‘javatpoint’, 5]
a. Dictionary
b. Tuple
c. List
d. Stack
Answer: ………………………………………..
13. SciPy stands for?
Ans : ………………………………………….
14. What will be output for the following code?
import numpy as np
print np.linspace(1., 4., 6)
A. array([ 1. , 2.2, 2.8, 3.4, 4. ])
B. array([ 1. , 1.6, 2.8, 3.4, 4. ])
C. array([ 1. , 1.6, 2.2, 2.8, 3.4, 4. ])
D. array([ 1. , 1.6, 2.2, 2.8, 4. ])
15.Action _______ of a robot arm specify to Place block A on
block B.
Ans : ……………………………………
16. What is true about Machine Learning?
A. Machine Learning (ML) is that field of computer science
B. ML is a type of artificial intelligence that extract patterns out
of raw data by using an algorithm
or method.
C. The main focus of ML is to allow computer systems learn
from experience without being
explicitly programmed or human intervention.
D. All of the above
Ans : …………………………………..
STUDENT NAME:……………………………………………………… CLASS NUMBER:…………………….
17. What is the maximum possible length of an identifier in
Python
a) 31 characters
b) 63 characters
c) 79 characters
d) none of the mentioned
Ans:………………………………………………………
18. Which is the correct operator for power(xy)?
a) X^y
b) X**y
c) X^^y
d) None of the mentioned
Ans:……………………………………………………..
19. Which one of these operators are for floor division?
a) /
b) //
c) %
d) None of the mentioned.
Ans:……………………………………………….
20. What will be output of the following Python Code:
print(25//5)
Ans:………………………………………….
21. What will be output of the following Python Code:
print(35.0//5)
Ans:………………………………………….
22. What will be output of the following Python Code:
print(45/5)
Ans:………………………………………….
23.What will be the out put for the following python code:
print(4*1**3)
Ans:……………………………………………….
24.which data type, indexing is not allowed in python?
a) List
b)String
c) Dictionary
d) None of the above
Ans:……………………………………………………………..
25. How can we create an empty list in python?
a) list=()
b) null
c) list
d) list=[]
Ans………………………………………
26. Which statement is true from following-
a) List is mutable & Tuple is immutable
b) List is immutable & Tuple is mutable
c) Both are Mutable.
d) Both are Immutable
Ans:……………………………………..
27. In Python a Function’s return statement can return
many/Multiple values.
a) True
b) False
Ans:………………………..
28.What will be the output of the following Python Code?
def fun():
s="rama"
x=20
return[s, x]
# Driver code to test above method
l=fun()
print(l)
Ans:……………………………………………………
29. Functions that do not return any value are known as
a) fruitful functions
b) void functions
c) library functions
d) user-defined functions
Ans:………………………………………………
30. What will be the output for the following python code:
def fUN():
global s
s += 'INDIA'
print(s)
s = "CHANDRAYAN-3"
print(s)
# Global Scope
s = "ADITYA-1 FROM "
fUN()
print(s)
Ans:……………………………………………………
STUDENT NAME:……………………………………………………… CLASS NUMBER:…………………….

pythonexam.docx

  • 1.
    STUDENT NAME:……………………………………………………… CLASSNUMBER:……………………. 1. What will be the expected output of the following python code? a="rama" print(type("rama")); print(a); Ans:……………………………………………………………. 2. What will be the expected output of the following python code: a=786; b=a; print(a); print(b); print(id(a)); print(id(b)); Ans:……………………………………………………………. 3.Python Comments are written by using ……………….. 4. Which of the following is the correct extension of the Python file? a) .python b) .pl c) .py d) .p Ans:………………………………………………….. 5. What will be the output of the following python code: b=45; print("a"+b); Ans:…………………………………………………… 6.What will be the output of the following python code: print("a"+"mmi"); Ans:………………………………………………………….. 7. What will be the output of the following Python Code: print([(5>8)&(8<0),(6>3)|(3>0), not 3>1]) Ans:…………………………………………………………. 8. Analyze the code and write the output for the following python code i = 0 while i < 3: print(i) i += 1 else: print(0) What will be the output of this statement? a. 0 1 b. 0 1 2 c. 0 1 2 0 d. 0 1 2 3 Ans……………………………… 9. What is the output of the following python code ‘9’ == 9 is executed? a. False b.True c. ValEAns:…………………………………………………… 10. Analyze the following statement z = {“a”:0, “b”:1} Which of the following is the correct statement? a. a dictionary z is created b. a and b are the keys of dictionary z c. 0 and 1 are the values of dictionary z d. All of the above Answer: ……………………………………. 11. Analyze the following program: 1. d = {0: ‘a’, 1: ‘b’, 2: ‘c’} 2. for i in d: 3. print(i) What will be the output of this statement? a. a b c b. 0 1 2 c. 0 a 1 b 2 c d. None of these above Answer: ………………………………………. 12. L will be belongs to the which data type in python? L = [2, 54, ‘javatpoint’, 5] a. Dictionary b. Tuple c. List d. Stack Answer: ……………………………………….. 13. SciPy stands for? Ans : …………………………………………. 14. What will be output for the following code? import numpy as np print np.linspace(1., 4., 6) A. array([ 1. , 2.2, 2.8, 3.4, 4. ]) B. array([ 1. , 1.6, 2.8, 3.4, 4. ]) C. array([ 1. , 1.6, 2.2, 2.8, 3.4, 4. ]) D. array([ 1. , 1.6, 2.2, 2.8, 4. ]) 15.Action _______ of a robot arm specify to Place block A on block B. Ans : …………………………………… 16. What is true about Machine Learning? A. Machine Learning (ML) is that field of computer science B. ML is a type of artificial intelligence that extract patterns out of raw data by using an algorithm or method. C. The main focus of ML is to allow computer systems learn from experience without being explicitly programmed or human intervention. D. All of the above Ans : …………………………………..
  • 2.
    STUDENT NAME:……………………………………………………… CLASSNUMBER:……………………. 17. What is the maximum possible length of an identifier in Python a) 31 characters b) 63 characters c) 79 characters d) none of the mentioned Ans:……………………………………………………… 18. Which is the correct operator for power(xy)? a) X^y b) X**y c) X^^y d) None of the mentioned Ans:…………………………………………………….. 19. Which one of these operators are for floor division? a) / b) // c) % d) None of the mentioned. Ans:………………………………………………. 20. What will be output of the following Python Code: print(25//5) Ans:…………………………………………. 21. What will be output of the following Python Code: print(35.0//5) Ans:…………………………………………. 22. What will be output of the following Python Code: print(45/5) Ans:…………………………………………. 23.What will be the out put for the following python code: print(4*1**3) Ans:………………………………………………. 24.which data type, indexing is not allowed in python? a) List b)String c) Dictionary d) None of the above Ans:…………………………………………………………….. 25. How can we create an empty list in python? a) list=() b) null c) list d) list=[] Ans……………………………………… 26. Which statement is true from following- a) List is mutable & Tuple is immutable b) List is immutable & Tuple is mutable c) Both are Mutable. d) Both are Immutable Ans:…………………………………….. 27. In Python a Function’s return statement can return many/Multiple values. a) True b) False Ans:……………………….. 28.What will be the output of the following Python Code? def fun(): s="rama" x=20 return[s, x] # Driver code to test above method l=fun() print(l) Ans:…………………………………………………… 29. Functions that do not return any value are known as a) fruitful functions b) void functions c) library functions d) user-defined functions Ans:……………………………………………… 30. What will be the output for the following python code: def fUN(): global s s += 'INDIA' print(s) s = "CHANDRAYAN-3" print(s) # Global Scope s = "ADITYA-1 FROM " fUN() print(s) Ans:……………………………………………………
  • 3.