Wednesday, November 5, 2025

Python Introduction and Python Conditional Statements, Class 8 Artificial Intelligence Question and Answer notes

 

🧠 Class 8 Artificial Intelligence Worksheet

📘 Chapter 1: Python Introduction

📗 Chapter 2: Python Conditional Statements


🔹 Section A — Textual Questions and Answers

Q1. What is Python?

Answer:
Python is a high-level, interpreted programming language used for general-purpose programming. It is easy to learn, read, and write because of its simple syntax.


Q2. List any four features of Python programming.

Answer:

  1. Easy to learn and use

  2. Open-source and free

  3. Portable and platform independent

  4. Large standard library and community support


Q3. What is an Interpreter in Python?

Answer:
An interpreter is a program that executes Python code line by line, translating it into machine language directly without the need for compilation.


Q4. What is IDLE in Python?

Answer:
IDLE (Integrated Development and Learning Environment) is the default editor that comes with Python. It provides an interface to write, run, and debug Python programs.


Q5. What is the difference between Python Shell and Script Mode?

Answer:

  • Shell Mode: Executes Python commands one at a time (interactive).

  • Script Mode: Used for writing and saving programs that can be executed later as a complete file.


Q6. What are Lines and Indentation in Python?

Answer:
In Python, indentation (spaces at the beginning of a line) is used to define code blocks instead of braces {}. Proper indentation is necessary for the code to run correctly.


Q7. What are Identifiers in Python?

Answer:
Identifiers are names used to identify variables, functions, classes, or other objects in Python.
Example: age, total_sum, printData


Q8. What are Keywords in Python?

Answer:
Keywords are reserved words in Python that have a special meaning and cannot be used as identifiers.
Example: if, else, for, while, def, return


Q9. What are Literals?

Answer:
Literals are constant values assigned to variables.
Example: 10, 'Hello', 3.14, True


Q10. What are Operators? Give examples.

Answer:
Operators are special symbols used to perform operations on variables and values.
Example:
+ (Addition), - (Subtraction), * (Multiplication), / (Division)


Q11. What are Variables in Python?

Answer:
Variables are used to store data values. Python automatically creates a variable when you assign a value to it.
Example:
x = 10


Q12. What are Delimiters in Python?

Answer:
Delimiters are symbols used to separate statements or indicate grouping in Python.
Examples:
( ), [ ], { }, :, ,, =, ;


Q13. What is the use of the input() function in Python?

Answer:
input() function allows the user to enter data from the keyboard during program execution.
Example:
name = input("Enter your name: ")


Q14. What is the use of the print() function in Python?

Answer:
print() function is used to display output on the screen.
Example:
print("Welcome to Python")


🔹 Section B — Python Conditional Statements

Q1. What are Conditional Statements in Python?

Answer:
Conditional statements allow a program to make decisions and execute different code based on certain conditions.


Q2. What are the types of Conditional Statements in Python?

Answer:

  1. if statement

  2. if...else statement

  3. if...elif...else statement

  4. Nested if statement


Q3. Write an example of an if statement.

Answer:

age = 18
if age >= 18:
    print("You are eligible to vote.")

Q4. Write an example of an if...else statement.

Answer:

num = 10
if num % 2 == 0:
    print("Even number")
else:
    print("Odd number")

Q5. Write an example of an if...elif...else statement.

Answer:

marks = 85
if marks >= 90:
    print("Grade A")
elif marks >= 75:
    print("Grade B")
else:
    print("Grade C")

Q6. What is a Nested if statement?

Answer:
A Nested if statement means using one if inside another if block to check multiple conditions.


🔹 Section C — Extra Short Answer Questions (1–2 Marks)

  1. Who developed Python?
    Answer: Guido van Rossum

  2. In which year was Python developed?
    Answer: 1991

  3. Name two data types in Python.
    Answer: Integer, String

  4. What symbol is used for comments in Python?
    Answer: # (hash symbol)

  5. Write the output of:

    print(2 + 3 * 4)
    

    Answer: 14

  6. What is the output of print("AI" * 3)?
    Answer: AIAIAI


🔹 Section D — Long Answer Questions (5–6 Marks)

Q1. Explain any five features of Python with examples.

Answer:

  1. Easy to Learn: Simple English-like syntax.
    Example: print("Hello")

  2. Interpreted Language: Executes line by line.

  3. Portable: Works on Windows, Mac, and Linux.

  4. Extensive Libraries: Has built-in modules like math, random, etc.

  5. Object-Oriented: Supports classes and objects.


Q2. Explain different types of conditional statements with examples.

Answer:
Python provides four main conditional statements:

  • if → Executes a block if condition is true.

  • if...else → Executes one block if true, another if false.

  • if...elif...else → Multiple condition checking.

  • Nested if → Condition inside another if.


🔹 Section E — Multiple Choice Questions (MCQs)

  1. Python was developed by _______.
    a) Dennis Ritchie
    b) James Gosling
    ✅ c) Guido van Rossum
    d) Charles Babbage

  2. Which of the following is a Python keyword?
    a) value
    ✅ b) while
    c) main
    d) print

  3. What is the correct file extension for Python files?
    ✅ a) .py
    b) .pt
    c) .python
    d) .p

  4. Which of the following is used for comments in Python?
    ✅ a) #
    b) //
    c) /* */
    d) !

  5. What is the output of print(5 > 3)?
    ✅ a) True
    b) False
    c) Error
    d) None

  6. Which function is used to get input from the user?
    a) scan()
    ✅ b) input()
    c) get()
    d) type()

  7. In an if statement, the condition must return:
    ✅ a) True or False
    b) 0 or 1
    c) Number
    d) Character

  8. Which symbol is used for assignment in Python?
    ✅ a) =
    b) ==
    c) :=
    d) =>


No comments:

Post a Comment