Introduction to Python and Basics

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 Catherine Halcomb
Catherine Halcomb
Community Contributor
Quizzes Created: 3677 | Total Attempts: 6,977,842
| Questions: 30 | Updated: Sep 14, 2026
Please wait...
Question 1 / 31
🏆 Rank #--
0 %
0/100
Score 0/100

1. What will be the output?print(17 // 5)

Explanation

The expression `17 // 5` uses the floor division operator `//`, which divides 17 by 5 and returns the largest integer less than or equal to the result. When 17 is divided by 5, the result is 3.4. However, since floor division only considers the integer part, it rounds down to 3. Thus, the output of the operation is 3.

Submit
Please wait...
About This Quiz
Introduction To Python and Basics - Quiz

This assessment focuses on fundamental concepts of Python programming, including syntax, data types, and operators. It evaluates your understanding of key features, such as the use of functions and comments. This resource is valuable for beginners looking to solidify their knowledge of Python basics and prepare for more advanced topics.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. What will be the output?x = 10print(x)# print(x + 5)

Submit

3. What will be the output?print(5 | 3)

Submit

4. What will be the output?print(5 & 3)

Submit

5. What will be the output?a = 6a += 4print(a)

Submit

6. What will be the output?name = "Amit"print("Hello", name)

Submit

7. What will be the output?print(float(7))

Submit

8. What will be the output?print(int(8.9))

Submit

9. What will be the output?print(not True)

Submit

10. What will be the output?print(True or False)

Submit

11. What will be the output?print(True and False)

Submit

12. What will be the output?a = 10b = 5print(a > b)

Explanation

In the given code, the expression `a > b` compares the values of `a` and `b`. Since `a` is 10 and `b` is 5, the comparison evaluates to true because 10 is indeed greater than 5. Therefore, the output of the print statement will be `True`.

Submit

13. What will be the output?x = 5x = x + 3print(x)

Explanation

In the given code, the variable `x` is initially assigned the value of 5. The expression `x = x + 3` updates `x` by adding 3 to its current value. Therefore, `x` becomes 5 + 3, which equals 8. The `print(x)` statement then outputs the updated value of `x`, resulting in 8 being displayed.

Submit

14. What will be the output?print(2 ** 4)

Explanation

The expression `2 ** 4` represents exponentiation in Python, where `2` is the base and `4` is the exponent. This means that `2` is multiplied by itself `4` times: `2 * 2 * 2 * 2`. Calculating this gives `4` (from the first two `2`s), then `8` (from the next multiplication), and finally `16` after the last multiplication. Therefore, the output of the code will be `16`.

Submit

15. What will be the output?print(17 % 5)

Explanation

The expression `17 % 5` calculates the remainder when 17 is divided by 5. In this case, 5 goes into 17 three times (which totals 15), leaving a remainder of 2. Thus, the output of the operation is 2, as it represents what is left over after the division.

Submit

16. Who created Python?

Explanation

Guido van Rossum is the creator of Python, a high-level programming language he began developing in the late 1980s and released in 1991. His vision was to create a language that emphasized code readability and simplicity, making it accessible for beginners while also powerful enough for experts. Python's design philosophy promotes clear syntax and encourages programming with fewer lines of code, contributing to its widespread adoption across various domains, including web development, data analysis, artificial intelligence, and more.

Submit

17. What will be the output?print(20 / 5)

Explanation

The output of the expression `print(20 / 5)` is `4.0` because in Python, the division operator `/` performs floating-point division. This means that even if the result is a whole number, it will be expressed as a float. In this case, dividing 20 by 5 yields 4, but since the operation is floating-point division, it is represented as `4.0`.

Submit

18. What will be the output?x = 10y = 20print(x + y)

Explanation

The output of the code is 30 because the variables x and y are assigned the values 10 and 20, respectively. The expression `x + y` adds these two values together. When the print function is called, it outputs the result of the addition, which is 30. The code executes without any errors, as both variables are defined correctly and the operation performed is valid.

Submit

19. What will be the output?print("Hello Python")

Explanation

The output of the print statement `print("Hello Python")` will display the string exactly as it is written within the parentheses. In this case, "Hello Python" is a single string, and the print function outputs it to the console without any additional formatting or errors. Therefore, the expected output is simply "Hello Python".

Submit

20. Which operator is used for exponentiation in Python?

Explanation

In Python, the operator used for exponentiation is `**`. This operator raises a number to the power of another number. For example, `2 ** 3` evaluates to `8`, which is 2 raised to the power of 3. The other options, such as `^`, `//`, and `%`, serve different purposes: `^` is a bitwise XOR operator, `//` performs floor division, and `%` computes the modulus. Thus, `**` is the specific operator designated for exponentiation in Python.

Submit

21. Which symbol is used for a single-line comment in Python?

Explanation

In Python, the symbol used for a single-line comment is the hash symbol (#). When the interpreter encounters this symbol, it ignores everything that follows it on that line, allowing programmers to add notes or explanations in their code without affecting its execution. This feature is essential for making code more understandable and maintainable, as it helps communicate the purpose or functionality of specific code segments to others or to the original author at a later time.

Submit

22. Which function is used to take input from the user?

Explanation

The `input()` function is used in programming to capture user input from the console. When called, it prompts the user to enter data, which can then be processed by the program. This function is commonly used in various programming languages, including Python, to facilitate interaction between the user and the application, allowing for dynamic input during runtime. Other options listed, such as `read()`, `scan()`, and `get()`, may not specifically serve this purpose or are used in different contexts or programming languages.

Submit

23. Which function converts a value into an integer?

Explanation

The function `int()` is designed to convert a given value into an integer type in programming languages like Python. It takes a number or a string representing a number as input and returns its integer equivalent. For instance, `int(3.5)` would yield `3`, and `int("10")` would return `10`. This functionality is essential for type conversion and ensures that numerical operations are performed with the correct data type. Other options like `integer()`, `float()`, and `number()` are either incorrect or do not serve the purpose of converting values to integers.

Submit

24. Which data type stores decimal numbers?

Explanation

The float data type is specifically designed to store decimal numbers, allowing for the representation of non-integer values. Unlike the int data type, which only accommodates whole numbers, floats can handle fractions and values with precision, making them ideal for calculations that require decimal points, such as measurements or financial data. This capability is essential in programming and mathematical computations where accuracy with decimal values is necessary.

Submit

25. Which of the following is a Python keyword?

Explanation

In Python, keywords are reserved words that have special meaning and cannot be used for variable names. "while" is a keyword used to create a loop that executes a block of code as long as a specified condition is true. The other options, such as "define," "function," and "integer," are not keywords in Python, making "while" the only correct choice among them.

Submit

26. Which of the following is a valid Python identifier?

Explanation

In Python, a valid identifier must start with a letter (a-z, A-Z) or an underscore (_) and can be followed by letters, digits (0-9), or underscores. Among the options, "2value" starts with a digit, making it invalid. "class" is a reserved keyword, so it cannot be used as an identifier. "first-name" contains a hyphen, which is not allowed. "student_name," however, starts with a letter and uses an underscore, making it a valid identifier.

Submit

27. Which mode executes one statement at a time immediately?

Explanation

Interactive mode allows users to execute commands one at a time, providing immediate feedback after each statement. This mode is particularly useful for testing snippets of code or for learning, as it enables a dynamic and responsive programming experience. Unlike batch mode, where multiple statements are processed together, or script and compile modes that involve pre-written code execution, interactive mode focuses on real-time interaction with the programming environment.

Submit

28. Python is mainly classified as a ______ language.

Explanation

Python is primarily classified as an interpreted language because its code is executed line by line at runtime, rather than being compiled into machine code beforehand. This allows for greater flexibility and ease of debugging, as developers can test and modify code interactively. The interpreter reads and executes the code directly, making it easier to write and run Python scripts without the need for a separate compilation step, which is characteristic of compiled languages.

Submit

29. Which of the following is a feature of Python?

Explanation

Python is designed with readability in mind, featuring a clean and straightforward syntax that resembles natural language. This makes it accessible for both beginners and experienced programmers, allowing them to write and understand code more easily. The emphasis on readability helps reduce the cost of program maintenance and enhances collaboration among developers.

Submit

30. Python was first released in which year?

Explanation

Python was created by Guido van Rossum and was first released to the public in February 1991. This release marked the beginning of Python's journey as a high-level programming language, designed for readability and simplicity. The language has since evolved significantly, gaining widespread popularity in various domains such as web development, data analysis, artificial intelligence, and more. The choice of 1991 as the release year is significant as it laid the foundation for Python's growth and community development over the following decades.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (30)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What will be the output?print(17 // 5)
What will be the output?x = 10print(x)# print(x + 5)
What will be the output?print(5 | 3)
What will be the output?print(5 & 3)
What will be the output?a = 6a += 4print(a)
What will be the output?name = "Amit"print("Hello", name)
What will be the output?print(float(7))
What will be the output?print(int(8.9))
What will be the output?print(not True)
What will be the output?print(True or False)
What will be the output?print(True and False)
What will be the output?a = 10b = 5print(a > b)
What will be the output?x = 5x = x + 3print(x)
What will be the output?print(2 ** 4)
What will be the output?print(17 % 5)
Who created Python?
What will be the output?print(20 / 5)
What will be the output?x = 10y = 20print(x + y)
What will be the output?print("Hello Python")
Which operator is used for exponentiation in Python?
Which symbol is used for a single-line comment in Python?
Which function is used to take input from the user?
Which function converts a value into an integer?
Which data type stores decimal numbers?
Which of the following is a Python keyword?
Which of the following is a valid Python identifier?
Which mode executes one statement at a time immediately?
Python is mainly classified as a ______ language.
Which of the following is a feature of Python?
Python was first released in which year?
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!