Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
19 views

Python Programming Question Bank UNIT-1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Python Programming Question Bank UNIT-1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Python Programming

Question Bank
UNIT - 1
Multiple Choice Questions

1._________are not allowed as part of an identifier.


a. Spaces
b. Numbers
c. Underscore
d. All of these

2. Identifiers may contain letters and digits, but cannot begin with a .
a. Character
b. Digit
c. Underscore
d. Special Symbols

3.Which is not a reserved keyword in Python?


a. insert
b. except
c. import
d. yield

4. is an identifier that has predefined meaning.


a. variable
b. identifier
c. keyword
d. None of these

5. Guess the output of the following code. 1 > 2 and 9 > 6


a. True
b. False
c. Machine Dependent
d. Error

6. Which operator returns the remainder of the operands?


a. /
b. //
c. %
d. **
7. Guess the output of the following expression.
float(22//3+3/3)
a. 8
b. 8.0
c. −8.3
d. 8.333
8. Single-line comments start with the symbol.
a. *#
b. #
c. *
d. &
9. Multiline comments can be done by adding on each end of the
comment.
a. "' "'(triple quote)
b. # (Hash)
c. $ (dollar)
d. % (modulus)
10. Python programs get structured through .
a. Alignment
b. Indentation
c. Justification
d. None
11. Which of the following function is used to read data from the keyboard?
a. function()
b. str()
c. input()
d. print()
12. control statement repeatedly executes a set of statements.
a. Iterative
b. Conditional
c. Multi-way
d. All of these
13. Which keyword is used to take the control to the beginning of the
loop?
a. exit
b. break
c. continue
d. None of these
14. The step argument in range() function .
a. indicates the beginning of the sequence
b. indicates the end of the sequence
c. indicates the difference between every two consecutive numbers in
the sequence
d. generates numbers up to a specified value
15. The symbol that is placed at the end of if condition is
a. ;
b. :
c. &
d. ~
16. What is the keyword that is used to come out of a loop only for that
iteration?
a. break
b. return
c. continue
d. if
17. Judge the output of the following code snippet.
for i in range(10):
if i == 5:
break
else:
print(i)
a. 0 1 2 3 4
b. 0 1 2 3 4 5
c. 0 1 2 3
d. 1 2 3 4 5
18. Predict the output of the following code
snippet. while True:
print(True)
break
a. True
b. False
c. None
d. Syntax error
19. The function that generates a sequence of numbers which can be
iterated through using for loop.
a. input()
b. range()
c. list()
d. raw_input()
20. What is the output of the following code snippet?
x = 'abcd'
for i in x:
print(i)
a. abcd
b. 0 1 2 3
c. iiiii
d. Traceback
21. The function of while loop is
a. Repeat a chunk of code a given number of times.
b. Repeat a chunk of code until a condition is true.
c. Repeat a chunk of code until a condition is false.
d. Repeat a chunk of code indefinitely.
5 Marks Questions
1. Write a short note on Type conversion in Python with examples.
2. Write a short note on data types in Python.
3. Differentiate the syntax of if...else and if...elif...else with an example.
4. Write the syntax of while loop with an example.
5. Write the syntax of for loop with an example.
6. What is the purpose of using break and continue?
7. Write the use of range() function with an example.

10 Marks Questions
1. Briefly explain different Operators in Python with examples.
2. Briefly explain how to read and print data in Python with examples.
3. Briefly explain the conditional statements available in Python with
examples.
4. Briefly explain the control statements available in Python with examples.

You might also like