Docsity

Python Programming: Input, Processing, and Output Fundamentals | Objective Assessment | Qu, Exams of Java Programming

Toggle sidebar
bg1
A+
Python Programming: Input, Processing, and Output
Fundamentals | Objective Assessment | Questions and
Answers with Verified Solutions |
Question: Answer:
What is the purpose of the print
function in Python?
To display output on the screen.
Question: Answer:
What does the assignment operator (=)
do in Python?
It creates a variable and makes it reference data.
Question: Answer:
What is a variable in Python? A name that represents a value stored in the computer
memory.
Question: Answer:
What is the result of the expression 5/2
in Python?
2.5 (floating point division).
Question: Answer:
What is the result of the expression
5//2 in Python?
2 (integer division).
pf3
pf4

Partial preview of the text

Download Python Programming: Input, Processing, and Output Fundamentals | Objective Assessment | Qu and more Exams Java Programming in PDF only on Docsity!

A+

Python Programming: Input, Processing, and Output

Fundamentals | Objective Assessment | Questions and

Answers with Verified Solutions |

Question: Answer:

What is the purpose of the print function in Python? To display output on the screen.

Question: Answer:

What does the assignment operator (=) do in Python? It creates a variable and makes it reference data.

Question: Answer:

What is a variable in Python? A name that represents a value stored in the computer memory.

Question: Answer:

What is the result of the expression 5/ in Python? 2.5 (floating point division).

Question: Answer:

What is the result of the expression 5//2 in Python? 2 (integer division).

What does the exponent operator (**) do? Raises a number to a power.

Question: Answer:

What is the remainder operator (%) used for? Performs division and returns the remainder.

Question: Answer:

What is the difference between floating point division and integer division? Floating point division (/) returns a decimal, while integer division (//) returns a whole number.

Question: Answer:

What is string concatenation in Python? Appending one string to the end of another using the

  • operator.

Question: Answer:

How do you read input from the keyboard in Python? Using the input() function, which returns the data as a string.

Question: Answer:

What happens if you try to perform arithmetic on strings in Python? It will result in an error unless the strings are converted to numeric types.

Question: Answer:

What is a comment in Python? Notes of explanation within a program, ignored by the Python interpreter.

What is the purpose of the assignment statement in Python? To create a variable and assign it a value.

Question: Answer:

What is the result of the expression -5//2 in Python? -3 (negative result rounded away from zero).

Question: Answer:

What does the print function do when multiple items are passed as arguments? Displays them in the order passed, separated by spaces.