0% found this document useful (0 votes)
6 views

Module 1 - Introduction to Python - Variables, Expressions, And Statements

The document contains a series of questions and answers related to Python programming, covering topics such as variable initialization, error types, user input, and output formatting. It also includes specific code examples and expected outputs. Additionally, it mentions the Python interpreter and its role in executing machine code.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Module 1 - Introduction to Python - Variables, Expressions, And Statements

The document contains a series of questions and answers related to Python programming, covering topics such as variable initialization, error types, user input, and output formatting. It also includes specific code examples and expected outputs. Additionally, it mentions the Python interpreter and its role in executing machine code.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

Which of the following contains “machine code”?

IDLE stands for ... ?

Which of the following is used to initialize multiple variables with a common


value? (in python)

x = y: y = 33

x = y = z = 33

x = z; y = z; x = 33;

x & y & z = 33

Comments in Python begin with ...?

A user-specified value can be assigned to a variable with this function ...

user

enter

input

value

User input is read as ...?

Floating Decimal

Text String

Boolean Value

Integer

Output displayed by the print function will add this invisible character at the end
of the line by default ...

Multiple values specified in parentheses to print function will display each value
separated with this by default ...

Single Space

Double Space

A new Line

Double Lines

Which of the following will provide an ! character as alternative separator for the
print function?

sep is !

separate = !

sep >> '!'

sep = '!'

Which of the following will provide a * character as alternative line ending for
the print function?

end to *

end as *

end = '*'

ending = '*'

For which type of error does the interpreter halts and reports the error but does
not execute the program?

Semantic error

Syntax error

Runtime error

All type of errors

For which type of error does the interpreter runs the program but halts at error
and reports the error as an "Exception"?

Semantic error

Syntax error

Runtime error

All type of errors

For which type of error does the interpreter runs the program and does not report
an error?

Semantic error

Syntax error

Runtime error

All type of errors


What is wrong with the following code:

>>> primt 'Hello world!' File "<stdin>", line 1 primt 'Hello world!'
SyntaxError: invalid syntax >>>

What will be the output after the following statements?

x = 3
y = 2
x += y
print(x)

What will be the output after the following statements?

x = 5
y = 7
x *= y
print(x)

What will be the output after the following statements?

x = 25
y = 15
x -= y
print(x)

What will be the output after the following statements?

x = 30
y = 7
x %= y
print(x)

What will be the output after the following statements?

x = 3
y = 7
print(x == y)

What will be the output after the following statements?

x = 83
y = 57
print(x > y)

What will be the output after the following statements?

x = True
y = False
print(x and y)
What will be the output after the following statements?

x = True
y = False
print(x or y)

What will be the output after the following statements?

x = True
y = False
print(not x)

What will be the output after the following statements?

x = True
y = False
print(not y)

What will be the output after the following statements?

x = 2 * 4 + 7
print(x)

What will the following program print out:

x = 43
x = x + 1
print(x)

What will be the output after the following statements?

x = '24' + '16'
print(x)

What will be the data type of x after the following statement if input entered is
18 ?

x = input('Enter a number: ')

What will be the data type of y after the following statements if input entered is
50?

x = input('Enter a number: ')


y = int(x)

Float

String

List

Integer
What will be the data type of y after the following statements?

x = 71
y = float(x)

Float

String

List

Integer

What will be the value of x, y and z after the following statement?

x, y, z = 3, 4, 5

All three will have the value of 3

All three will have the value of 345

x will have the value of 3, y will have the value 4 and z will have the value of 5

x and y will have arbitrary values, while z will have the value of 345

What will be the output after the following statements?

x = y = z = 8
print(y)

What is the name of the GUI that comes in-built as an interactive shell with
Python?

Python files are saved with the extension as ...?

Which of the following version of Python was released in February, 2023 by


Python.org?
3.12.2

Which of the following contains “machine code”?

The Python interpreter

The keyboard

Python source file

A word processing document

* Thuc ra ae co the vo lai form bai 1 xem, co ca dung sai.

You might also like