0% found this document useful (0 votes)
55 views7 pages

Answer Key

Uploaded by

ktoshit1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views7 pages

Answer Key

Uploaded by

ktoshit1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

ANSWER KEY

Section A: Multiple Choice Questions (MCQs)

1. b) Self-driving car
Explanation: AI powers self-driving cars to analyze and make decisions.
2. c) def
Explanation: def is the Python keyword used to define a function.
3. b) 17
Explanation: Python follows operator precedence: 3 * 5 = 15 first, then 2 + 15 =
17.
4. d) Machine Learning
Explanation: Machine Learning is a technique within AI, not a type of AI like reactive
machines or limited memory.
5. d) Information
Explanation: AI domains include Data, Computer Vision, and NLP. "Information" is too
broad and not a specific AI domain.
6. b) Python is an interpreted language
Explanation: Python code is executed line-by-line at runtime, making it an interpreted
language.
7. a) input()
Explanation: The input() function is used to take user input in Python.
8. c) Integer
Explanation: len() returns an integer indicating the length of a string.
9. c) Artificial Intelligence
Explanation: AI simulates human intelligence in machines.
10. b) Testing the performance of the AI model
Explanation: Model Evaluation checks how well the trained model performs on unseen data.

Section B: True and False

1. True
Explanation: AI performs tasks requiring human-like intelligence, such as problem-solving
and learning.
2. False
Explanation: The else block is executed when the condition in an if statement is false, not
true.
3. True
Explanation: "Model Deployment" involves using the trained AI model in real-world
applications.
4. False
Explanation: Python supports object-oriented programming (OOP) with classes and objects.
5. False
Explanation: Data Pre-processing is an early step in the AI Project Cycle, not the final step.

Q1: Python Program to Print the Sum of the First 10 Natural Numbers
python
Copy code
# Initialize the sum variable
total_sum = 0

# Use a for loop to iterate through the first 10 natural numbers


for i in range(1, 11):
total_sum += i # Add the current number to the total sum

# Print the result


print("The sum of the first 10 natural numbers is:", total_sum)

Output:
The sum of the first 10 natural numbers is: 55

Q2: Python Program to Check if a Number is Even or Odd


python
Copy code
# Take user input
number = int(input("Enter a number: "))

# Use if-else to check if the number is even or odd


if number % 2 == 0:
print(f"The number {number} is even.")
else:
print(f"The number {number} is odd.")

Example Input/Output:
Input: 8
Output: The number 8 is even.

Input: 5
Output: The number 5 is odd.

Q4: Python Program to Find the Largest Number Among Three Numbers

python
Copy code
# Take three numbers as input from the user
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
num3 = float(input("Enter the third number: "))

# Use conditional statements to determine the largest number


if num1 >= num2 and num1 >= num3:
largest = num1
elif num2 >= num1 and num2 >= num3:
largest = num2
else:
largest = num3

# Print the largest number


print(f"The largest number among {num1}, {num2}, and {num3} is:
{largest}")

Example Input/Output:
Input: 5, 10, 8
Output: The largest number among 5.0, 10.0, and 8.0 is: 10.0

Q5: Python Program to Find the Greater Value Among -12, 15, and 17

python
Copy code
# Initialize the numbers
a, b, c = -12, 15, 17

# Use the max() function to find the greatest number


greatest = max(a, b, c)

# Print the result


print(f"The greatest number among {a}, {b}, and {c} is:
{greatest}")

Output:
The greatest number among -12, 15, and 17 is: 17

Section D: One Word Answers

1. Artificial Intelligence
2. Natural Language Processing
3. input
4. print
5. To check additional conditions

Section E: Short Answer Questions

Q1: Define Artificial Intelligence (AI). Give two examples of AI in everyday life.

Definition: Artificial Intelligence (AI) is the simulation of human intelligence in machines that are
programmed to think and learn.
Examples:

1. Virtual Assistants like Siri or Alexa.


2. Self-driving cars.

Q2: Explain the difference between Sequential and Selective Statements in


Python.

Sequential Statements: These are executed line by line, in the order they appear.
Example:
python
Copy code
print("Hello")
print("World")

Selective Statements: These execute based on a condition, using constructs like if, if-else, or
elif.
Example:

python
Copy code
if age >= 18:
print("Eligible for voting")
else:
print("Not eligible")

Q3: Explain 3 different shapes from a flowchart.

1. Oval: Represents the start or end of a process.


2. Rectangle: Represents a process or instruction.
3. Diamond: Represents a decision point (e.g., yes/no).

Q4: Algorithm to Check Eligibility for Driving License

1. Start.
2. Input the user's age.
3. If age ≥ 18, print "Eligible for driving license."
4. Else, print "Not eligible for driving license."
5. End.

Q5: Flowchart for Checking Eligibility for Driving License

(Refer to a drawing tool or pen to illustrate this: Include a start symbol, input age, decision
diamond, and outputs for eligibility.)

Q6: What is Data Typecasting? Explain All Types.

Definition: Data typecasting is the process of converting one data type into another in Python.
Types:

1. Implicit Typecasting: Python automatically converts smaller data types to larger ones (e.g.,
int to float).
2. Explicit Typecasting: The user manually converts a data type using functions like int(),
float(), str(), etc.
Section F: Long Answer Questions

Q1: Types of Data Types in Python

Primitive Types:

 int: Integer numbers (e.g., 5)


 float: Decimal numbers (e.g., 3.14)
 str: Strings (e.g., "hello")
 bool: Boolean values (e.g., True, False)

Non-Primitive Types:

 list: Ordered collection (e.g., [1, 2, 3])


 tuple: Immutable collection (e.g., (1, 2, 3))
 dict: Key-value pairs (e.g., {"key": "value"})
 set: Unordered collection (e.g., {1, 2, 3})

Q2: Purpose of Comments in Python

Definition: Comments are used to describe code and make it more readable.
Types:

1. Single-line Comments: Begin with #.


Example:

python
Copy code
# This is a single-line comment
print("Hello World")

2. Multi-line Comments: Enclosed in ''' or """.


Example:

python
Copy code
'''
This is a
multi-line comment
'''
print("Hello World")

Q3: Advantages and Disadvantages of Flowchart and Algorithm

Advantages:

1. Visual clarity (Flowchart).


2. Step-by-step approach (Algorithm).
Disadvantages:

1. Time-consuming to draw (Flowchart).


2. Ambiguity in language (Algorithm).

Q4: Main Concepts of AI

1. Machine Learning: Machines learn from data without explicit programming.


2. Natural Language Processing (NLP): Enables machines to understand human language.
3. Computer Vision: Allows machines to interpret and analyze visual inputs.
4. Robotics: AI is used to control and automate robots.

Q5: If-Else Statements in Python

Explanation: The if-else statement allows conditional execution.


Example:

python
Copy code
num = int(input("Enter a number: "))
if num > 0:
print("The number is positive.")
else:
print("The number is negative.")

Q6: Sequential Flow in Python

Definition: Code executes line by line.


Example:

python
Copy code
print("Start")
print("Process")
print("End")

Q7: Program to Check Prime Number


python
Copy code
# Input number
num = int(input("Enter a number: "))

# Check if prime
if num > 1:
for i in range(2, num):
if num % i == 0:
print(f"{num} is not a prime number.")
break
else:
print(f"{num} is a prime number.")
else:
print(f"{num} is not a prime number.")

You might also like