Part B : Subject Specific Skills
th
CLASS 10
CHAPTER 3
Artificial Intelligence
CODE:- (417)
L-2
GLOSSARY
Jupyter Notebook It is a powerful tool widely used in the field of data science,
research, and education Jupyter Notebooks support various programming
languages, but it is most commonly associated with Python.
Virtual Environment It is a self-contained directory that encapsulates a specific
Python interpreter and its associated libraries.
Package It is a collection of Python modules organised in a directory hierarchy.
Keywords They are reserved words that have special meanings and cannot be
used as identifiers.
Identifiers They are names used to identify variables, functions, classes,
modules, or other objects in the code Conditional statement It allows you to
control the flow of program based on certain conditions.
Loops They are used to repeatedly execute a block of code until a specified
condition is met.
QUESTIONS
[QUESTION] 1 Which of the following Is a loop statement?
(a) at = 1
(b) if a > b;
(c) while a > 7:
(d) whilenot a > 7:
[QUESTION] Which of the following statements) is/are incorrect about Python?
i. Python is an Object Oriented language
ii. Python is a machine level language
iii. Python needs high maintenance
iv. Python doesn't focus on readability
(a) (i) and (iii) only
(b) (ii), (iii) and (iv)
(c) (iv) only
(d) (ii) and (iii)
QUESTIONS
[QUESTION] Which of the following is not used as a loop in Python?
(a) while
(b) for
(c) do while
(d) None of these
[QUESTION] Which symbol is used to represent a comment in Python?
(a) //
(b) #
(c) -
(d) !
QUESTIONS
[QUESTION] What is a variable in Python used for?
(a) To store and manipulate data
(b) To perform calculations
(c) To draw shapes
(d) To display the comments
[QUESTION] Which function is used to take user input in Python?
(a) get_input()
(b) user_input()
(c) inputs()
(d) input()
QUESTIONS
[QUESTION] What Is the purpose of control statements in Python?
(a) To control the flow of program execution
(b) To control the screen brightness
(c) To control the font size
(d) To control the flow of text
[QUESTION] Which of the following is a valld data type in Python?
(a) character
(b) loop
(c) string
(d) new character
QUESTIONS
[QUESTION] What command is used to display the output in Python?
(a) print()
(b) display()
(c) show()
(d) None of these
[QUESTION] Which symbol is used for exponentiation in Python?
(a) ^
(b) **
(c) %
(d) $
QUESTIONS
[QUESTION] What is the purpose of packages in Python?
(a) To organise code into modules
(b) To wrap gifts
(c) To create graphics
(d) To organise data
[QUESTION] Which of the following is not a valid data type in Python?
(a) float
(b) decimal
(c) complex
(d) int
QUESTIONS
[QUESTION] What is the purpose of If statement in Python?
(a) To define a function
(b) To create a loop
(c) To make decisions in the code
(d) To swap values
[QUESTION] Which command Is used to Install external packages in Python?
(a) import
(b) install
(c) pip
(d) export
QUESTIONS
[QUESTION] Which of the following is a logical operator in Python?
(a) ++
(b) AND
(c) //
(d) IF
[QUESTION] Which of the following is a correct match?
1. Keyword (i) Integer
2. Data type (ii) #
3. Comment (iii) finally
(a) 1 → (iii); 2 → (ii); 3 → (i)
(b) 1 → (i); 2 → (ii); 3 → (iii)
(c) 1 → (ii); 2 → (i); 3 → (iii)
(d) 1 → (iii); 2 → (i); 3 → (ii)
STATEMENT BASED QUESTIONS
[QUESTION] Statement 1: Jupyter Notebook App is a server-client application that
allows editing and running notebook documents via a web browser.
Statement 2: Jupyter Notebook App can be executed on a local desktop
requiring no internet access
(a) Both Statement 1 and Statement 2 are correct
(b) Both Statement 1 and Statement 2 are incorrect
(c) Statement 1 is correct but Statement 2 is incorrect
(d) Statement 2 is correct but Statement 1 is incorrect
[QUESTION] Statement 1: Python is a high-level, general-purpose, and very popular
programming language.
Statement 2: It was created by James Gosling, and released in 1991.
(a) Both Statement 1 and Statement 2 are correct
(b) Both Statement 1 and Statement 2 are incorrect
(c) Statement 1 is correct but Statement 2 is incorrect
(d) Statement 2 is correct but Statement 1 is incorrect
STATEMENT BASED QUESTIONS
[QUESTION] Statement 1: The process of traversing a sequence is known as iteration.
Statement 2: Loop iterates until the final item of the sequence are
reached.
(a) Both Statement 1 and Statement 2 are correct
(b) Both Statement 1 and Statement 2 are incorrect
(c) Statement 1 is correct but Statement 2 is incorrect
(d) Statement 2 is correct but Statement 1 is incorrect
[QUESTION] Statement 1: Tuples, like lists, also contain a collection of items from
various data types.
Statement 2: A parenthetical space I] separates the tuple's components
from one another.
(a) Both Statement 1 and Statement 2 are correct
(b) Both Statement 1 and Statement 2 are incorrect
(c) Statement 1 is correct but Statement 2 is incorrect
(d) Statement 2 is correct but Statement 1 is incorrect
ASSERTION & REASON BASED QUESTIONS
[QUESTION] Assertion (A) A variable in Python can change Its value during the
execution of the program.
Reason (R) Python is a dynamically typed language.
(a) Both A and Rare correct and R is the correct explanation of A
(b) Both A and Rare correct but R is not the correct explanation of A
(c) A is correct but R is not correct
(d) A is not correct but R is correct
[QUESTION] Assertion (A) The If statement is used for conditional execution in Python.
Reason (R) The if statement is followed by a block of code that is executed
only if the condition is true.
(a) Both A and Rare correct and R is the correct explanation of A
(b) Both A and Rare correct but R is not the correct explanation of A
(c) A is correct but R is not correct
(d) A is not correct but R is correct
ASSERTION & REASON BASED QUESTIONS
[QUESTION] Assertion (A) The % operator Is used for modulo arithmetic in Python.
Reason (R) The / operator is used for integer division in Python.
(a) Both A and Rare correct and R is the correct explanation of A
(b) Both A and Rare correct but R is not the correct explanation of A
(c) A is correct but R is not correct
(d) A is not correct but R is correct
[QUESTION] Assertion (A) for loop is also called as "Entry controlled loop".
Reason (R) For loop can be written to traverse a sequence.
(a) Both A and Rare correct and R is the correct explanation of A
(b) Both A and Rare correct but R is not the correct explanation of A
(c) A is correct but R is not correct
(d) A is not correct but R is correct
VERY SHORT ANSWER TYPE QUESTIONS
[QUESTION] What is the output of print(type(25))?
[ANSWER] The output is <class 'int'>.
[QUESTION] Give one example of variable.
[ANSWER] age = 25, where age is the variable storing the value 25.
[QUESTION] Define Pandas libraries.
[ANSWER] Pandas is an open-source data manipulation and analysis library for
Python. It provides data structures like DataFrame for efficient data handling.
[QUESTION] Define operator precedence.
[ANSWER] Operator precedence determines the order in which operators are
evaluated in an expression. It ensures that certain operators are evaluated
before others.
VERY SHORT ANSWER TYPE QUESTIONS
[QUESTION] Give one example of each of the following:
Unary operator
Comparison operator
[ANSWER] (a) Unary operator: ~x (negation)
(b) Comparison operator: == (equality)
[QUESTION] Mention any one feature of List in Python.
[ANSWER] Lists in Python are versatile and can store elements of different data types
in an ordered and mutable sequence.
[QUESTION] What do you understand by Iteration in programming?
[ANSWER] Iteration is the process of repeatedly executing a set of
statements or a block of code.
VERY SHORT ANSWER TYPE QUESTIONS
[QUESTION] Give any two features of OpenCV.
[ANSWER] Two features include image recognition and object detection.
[QUESTION] Name the operator used for the following:
To assign a value to a variable
That returns True or False.
[ANSWER] (a) =
(b) Comparison operators, such as == or !=
[QUESTION] What is the minimum number of iterations that while loop could make?
[ANSWER] while loop could make minimum 0 iteration.
SHORT ANSWER TYPE QUESTIONS
[QUESTION] Identify and correct the errors) from the given below variables.
(i) STD - -
(ii) 5STD
(iii) D$
(iv) (Marks)
[ANSWER] (i) Error STD - - is not allowed. The correct form is STD.
(ii) Error 5STD First character must be alphabet. The correct form is STD5.
(iii) Error D$ $ is not allowed. The correct form is D.
(iv) Error (Marks) Brackets are not allowed. The correct form is Marks.
SHORT ANSWER TYPE QUESTIONS
[QUESTION] Differentiate between identifier and keyword.
[ANSWER] Differences between identifier and keyword are as follows:
IDENTIFIER KEYWORD
Identifier consists any combination of Keyword must consist only letters.
letters, numbers and underscores. It allows only lowercase.
It allows both uppercase and lowercase. e.g. finally, continue, yield etc.
e.g. x, sum_5,_mul etc.
SHORT ANSWER TYPE QUESTIONS
[QUESTION] What is the difference between statement and expression?
[ANSWER] Differences between statement and expression are as follows
STATEMENT EXPRESSION
A statement is a complete line of code
An expression is any section of the code that
that performs some action.
evaluates to a value.
Statements can only be combined
Expressions can be combined horizontally
vertically by writing one after another
into larger expressions using operators.
or with block constructs.
SHORT ANSWER TYPE QUESTIONS
[QUESTION] WShreya is programming in Python and writing a following code. But she
found an error, what is the reason? Competency Based Ques
a = 10
b = 20
c = a + b
print ("The output is:", c)
[ANSWER] The above code is identation error and correct code is
a = 10
b = 20
c = a + b
print ("The output is :", c)
SHORT ANSWER TYPE QUESTIONS
[QUESTION] Find the syntax error in the following program and underline after
correct them.
w = 90 ;
while(w > 60)
print (w)
w = w - 50
[ANSWER] Correct code is
w = 90
while(w>60):
print(w)
w = w - 50
SHORT ANSWER TYPE QUESTIONS
[QUESTION] Construct logical expressions to represent the following conditions.
(i) Weight is greater than or equal to 115 but less than 125.
(ii) Donation is in the range of 4000-5000 or Guest is 1.
[ANSWER] (i) (weight >=115 and weight < 125)
(ii) ((Donation >= 4000 and Donation <= 5000) or Guest = =1)
[QUESTION] What is a Python package?
[ANSWER] A Python package is a way of organising related modules into a single
directory hierarchy. It helps in structuring Python's module namespace and
avoids naming conflicts. Packages are directories containing module files and
an_init-py file. They provide a means of creating a hierarchical structure to
organise and distribute Python code.
SHORT ANSWER TYPE QUESTIONS
[QUESTION] Write a Python program to calculate simple interest and display it.
[ANSWER]
p = int(input("Enter the principal:"))
r = int(input ("Enter rate of interest:"))
t = int(input ("Enter time: "))
si = (p*r*t) / 100
print ("The simple interest is", si)
Output
Enter the principal: 5000
Enter rate of interest: 10
Enter time: 2
The simple interest is 1000.0
LONG ANSWER TYPE QUESTIONS
[QUESTION] Write a Python program with output to convert the centimeter value into
meter and kilometer.
[ANSWER]
centimeter = float (input ("Enter value
in centimeters: " ))
meter = centimeter / 100.0;
kilometer = centimeter / 100000.0;
# Driver Code
print ("Length in meter = " , meter, "m");
print("Length in Kilometer = ",
kilometer, "km");
Output
Enter value in centimeters: 5000
Length in meter = 50.0 m
Length in Kilometer = 0.05 km
LONG ANSWER TYPE QUESTIONS
[QUESTION] Write a program to check whether a number is prime or not.
[ANSWER]
n = int (input("Enter the number: "))
print ("n=", n)
if n>1:
for i in range (2, n//2):
if (n%i) = = 0:
print(n, "is not a prime number")
break
else:
print(n, "is a prime number")
else: Output
print(n, " is not a prime number") Enter the number: 67
n =67
67 is a prime number
LONG ANSWER TYPE QUESTIONS
[QUESTION] Write a program in Python to accept monthly salary from the user, find
and display income tax with the help of following rules.
Monthly Salary Income Tax
9000 or more 40% of monthly salary
7500-8999 30% of monthly salary
7499 or less 20% of monthly salary
[ANSWER]
itax = 0
sal = int(input("Enter monthly salary:"))
if (sal>=9000) :
itax = sal * 0.40
elif (sal>=7500 and sal <= 8999):
itax-sal * 0.30 OUTPUT
elif (sal<=7499) : Enter monthly salary: 15000
itax = sal * 0.20 Income tax is 6000.0
print ("Income tax is ", itax)
THANK - YOU