Unit 1: Setting up your Programming Environment; Variables, Expression and Statements - Subjective Questions

INT108 — Python Programming • Practice Questions with Detailed Answers

20 questions

1

Explain the significance of Python versions. How can a programmer check the installed Python version?

2

Describe the steps required to install and configure Python on a Windows computer.

3

Write a Python program that displays Hello, World! and explain how to save and run it on Windows.

4

Define a variable in Python. Explain how variables are created, assigned, and updated with suitable examples.

5

What is a NameError in Python? Explain common situations that cause it and methods for avoiding it.

6

Distinguish between a value, a variable, and a data type in Python. Give examples of each.

7

Explain Python's basic value types and show how type conversion can be performed between compatible types.

8

State and explain the rules and recommended conventions for naming variables in Python.

9

What are Python keywords? Explain why they cannot be used as variable names and describe how to view the keyword list.

10

Define a statement in Python. Describe assignment, expression, and output statements using examples.

11

Differentiate between operators and operands. Classify the major operators available in Python with examples.

12

Explain the difference among /, //, %, and ** in Python. Evaluate each operator using suitable operands.

13

Explain the order of operations in Python. Evaluate result = 2 + 3 * 4 ** 2 - 8 / 2 step by step.

14

Discuss associativity in Python expressions. Why does exponentiation behave differently from most arithmetic operators?

15

Describe the operations that can be performed on strings in Python, including concatenation, repetition, indexing, slicing, and membership testing.

16

Compare arithmetic addition with string concatenation in Python. What errors can occur when incompatible types are combined?

17

What is composition in programming? Explain how Python combines variables, expressions, and function calls into larger expressions.

18

Develop a Python program that stores a student's name and three marks, calculates the total and average, and displays a formatted result. Explain the role of variables, operators, and composition in the program.

19

Explain the purpose of comments in Python. Distinguish comments from docstrings and state good commenting practices.

20

Analyze and correct the errors in the following program: class = Python, 2score = 40, total = score + bonus, and print("Total: " + total). Explain every correction.