Home assignment programming language 1
Online Python - IDE, Editor, Compiler, Interpreter (online-python.com)
you can use this link to test the instructions.
1. The function to display a specified message on the
screen is ... ?
a. print
b. display
c. run
d. output
2. Which of the following is an assignment operator
in Python?
a. ==
b. ===
c. >>>
d. =
3. Which of the following is used to initialize multiple
variables with a common value?
a. x = y: y = 33
b. x = y = z = 33
c. x = z; y = z; x = 33;
d. x & y & z = 33
4. Comments in Python begin with ...?
a. {
b. %
c. *
d. #
5. A user-specified value can be assigned to a variable
with this function ...
a. user
b. enter
c. input
d. value
6. User input is read as ...?
a. Floating Decimal
b. Text String
c. Boolean Value
d. Integer
7. Output displayed by the print function will add this
invisible character at the end of the line by default ...
a. \t
b. \n
c. \s
d. \r
8. Multiple values specified in parentheses to print
function will display each value separated with this by
default ...
a. Single Space
b. Double Space
c. A new Line
d. Double Lines
9. Which of the following will provide an ! character as
alternative separator for the print function?
a. sep is !
b. separate = !
c. sep >> '!'
d. sep = '!'
10. Which of the following will provide a * character as
alternative line ending for the print function?
a. end to *
b. end as *
c. end = '*'
d. ending = '*'
11. For which type of error does the interpreter halts
and reports the error but does not execute the
program?
a. Semantic error
b. Syntax error
c. Runtime error
d. All type of errors
12. For which type of error does the interpreter runs
the program but halts at error and reports the error as
an "Exception"?
a. Semantic error
b. Syntax error
c. Runtime error
d. All type of errors
13. For which type of error does the interpreter runs
the program and does not report an error?
a. Semantic error
b. Syntax error
c. Runtime error
d. All type of errors
14. What will be the output after the following
statements? x = 6 y = 3 print(x / y)
a. 2.0
b. 2
c. 18
d. 18.0
15. What will be the output after the following
statements?
x=8
y=2
print(x // y)
a. 4.0
b. 4
c. 16
d. 16.0
16. What will be the output after the following
statements?
x=5
y=4
print(x % y)
a. 0
b. 20
c. 1.0
d. 1
17. What will be the output after the following
statements? x = 3
y=2
x += y
print(x)
a. 3 b. 2 c. 5 d. 1
18. What will be the output after the following
statements?
x=5
y=7
x *= y print(x)
a. 7 b. 12 c. 5 d. 35
19. What will be the output after the following
statements?
x = 25
y = 15
x -= y
print(x)
a. 10 b. 25 c. 15 d. -15
20. What will be the output after the following
statements?
x = 30
y=7
x %= y
print(x)
a. 4 b. 28 c. 2 d. 37
21. What will be the output after the following
statements?
x=3
y=7
print(x == y)
a. y = 7 and x = 3
b. True
c. x = 3 and y = 3
d. False