Understanding Python Basics with Print and Variables

  • 7th Grade
Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Themes
T
Themes
Community Contributor
Quizzes Created: 583 | Total Attempts: 1,078,491
| Questions: 15 | Updated: Mar 12, 2026
Please wait...
Question 1 / 15
🏆 Rank #--
0 %
0/100
Score 0/100

1. What is the output of print(11)?

Explanation

When the `print()` function is called with the argument `11`, it outputs the value directly to the console. In Python, `print()` displays the provided argument as it is, without any modifications or formatting. Since `11` is a valid integer, the function simply prints it as is, resulting in the output being `11`.

Submit
Please wait...
About This Quiz
Understanding Python Basics With Print and Variables - Quiz

This assessment focuses on fundamental Python concepts, including print statements, variables, and user input. It evaluates skills such as understanding data types, variable naming conventions, and string manipulation. This knowledge is crucial for beginners looking to build a solid foundation in Python programming.

2. What will print("1" + "1") output?

Explanation

In Python, the `+` operator is used for string concatenation when applied to strings. When you use `print("1" + "1")`, it combines the two string literals "1" and "1" together, resulting in "11". Unlike numerical addition, which would yield 2, string addition treats the values as text and concatenates them. Thus, the output of the operation is "11".

Submit

3. What is the purpose of the input() function?

Explanation

The input() function is designed to receive data from the user. When called, it pauses program execution and waits for the user to type something into the console. Once the user presses Enter, the function captures the input as a string, allowing the program to use this information for further processing, such as storing it in a variable or performing operations based on it. This interaction makes the program dynamic and responsive to user needs.

Submit

4. What will be the output of print(1 + 1)?

Explanation

In Python, the expression `1 + 1` performs an arithmetic addition of the two integer values. When you add 1 and 1 together, the result is 2. The `print` function then outputs this result to the console. Therefore, when executing `print(1 + 1)`, the output will be the integer 2, as it correctly reflects the sum of the two numbers.

Submit

5. What does the variable 'car' store in the code car = "toyota"?

Explanation

In the code `car = "toyota"`, the variable 'car' is assigned the value "toyota", which is enclosed in quotes. This indicates that the value is a sequence of characters, thus classifying it as a string. Strings are used to represent text in programming, distinguishing them from numerical data types like integers or lists, which serve different purposes.

Submit

6. Which of the following is NOT a valid variable name?

Explanation

Variable names in most programming languages must start with a letter or an underscore, not a digit. In this case, "2ndVariable" begins with the digit '2', making it an invalid variable name. The other options, "myVariable," "my_variable," and "myVariable2," all start with letters and adhere to the naming conventions, thus they are valid.

Submit

7. What will be the output of print("hello " + "goodbye")?

Explanation

The output of the print statement combines two strings: "hello " and "goodbye". In Python, the "+" operator concatenates these strings, resulting in "hello goodbye". There are no syntax errors or additional characters, so the output will be exactly as expected, without any extra punctuation or spaces beyond what is included in the strings themselves.

Submit

8. What type of data does the input function return?

Explanation

The input function in Python reads user input as a string, regardless of the content entered. This means that even if a user types in numbers or other data types, the function treats the input as a sequence of characters. To convert the input into other data types, such as integers or floats, additional functions like int() or float() must be used. Therefore, the primary output of the input function is always a string.

Submit

9. What will be the output of print("my best friend is " + friend) if friend = "Alice"?

Explanation

The output of the print statement combines the string "my best friend is " with the value of the variable `friend`, which is "Alice". In Python, the `+` operator is used for string concatenation, so when executed, it results in the complete string "my best friend is Alice". There are no syntax errors or extra characters, making this the expected output.

Submit

10. What does new_age = int(age) + 100 do?

Explanation

The expression `new_age = int(age) + 100` first converts the variable `age`, which is likely a string, into an integer using the `int()` function. After the conversion, it adds 100 to this integer value. This operation results in a new integer value representing the age increased by 100 years. The process ensures that any arithmetic operation can be performed on the age, which is crucial for accurate calculations.

Submit

11. What will be the output of print(x, y) if x, y = 10, 15?

Explanation

When the statement `x, y = 10, 15` is executed, it assigns the value 10 to `x` and 15 to `y`. Therefore, when calling `print(x, y)`, it outputs the values of `x` and `y` in the order they were assigned, resulting in "10 15". The print function separates the values with a space by default, which is why the output appears as two distinct numbers rather than a tuple or any other format.

Submit

12. What will be the output of print(a + b + c) if a, b, c = "one", "two", "three"?

Explanation

When variables a, b, and c are assigned the strings "one", "two", and "three" respectively, the expression a + b + c concatenates these strings together. In Python, the + operator for strings combines them without any additional spaces or characters. Therefore, the output of print(a + b + c) will be the single continuous string "onetwothree".

Submit

13. Which of the following is a valid way to define multiple variables?

Explanation

In Python, multiple variables can be assigned values simultaneously using tuple unpacking. The syntax `x, y = 10, 15` allows both variables to be defined in a single line, where `x` is assigned the value `10` and `y` is assigned the value `15`. This method is concise and efficient, making it a valid way to define multiple variables compared to other options that either use incorrect syntax or separate assignments.

Submit

14. What will be the output of print("i will be " + str(new_age) + " years old in 100 years from now") if new_age = 120?

Explanation

The output of the print statement is generated by concatenating a string with the value of `new_age`, which is set to 120. The expression `str(new_age)` converts the integer 120 to a string, allowing it to be combined with other string components. Therefore, the final output correctly reads "i will be 120 years old in 100 years from now," reflecting the value of `new_age` in the context of the sentence.

Submit

15. What will be the output of print("hello, world!")?

Explanation

The output of the print statement in Python directly reflects the string provided within the parentheses. In this case, the string is "hello, world!" which includes both the lowercase letters and the comma. When executed, the print function outputs the exact text as it is written, including punctuation and spacing. Therefore, the output will be "hello, world!" as specified in the print statement.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (15)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What is the output of print(11)?
What will print("1" + "1") output?
What is the purpose of the input() function?
What will be the output of print(1 + 1)?
What does the variable 'car' store in the code car = "toyota"?
Which of the following is NOT a valid variable name?
What will be the output of print("hello " + "goodbye")?
What type of data does the input function return?
What will be the output of print("my best friend is " + friend) if...
What does new_age = int(age) + 100 do?
What will be the output of print(x, y) if x, y = 10, 15?
What will be the output of print(a + b + c) if a, b, c = "one", "two",...
Which of the following is a valid way to define multiple variables?
What will be the output of print("i will be " + str(new_age) + " years...
What will be the output of print("hello, world!")?
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!