You are on page 1of 3

Class IX

ARTIFICIAL INTELLIGENCE
PYTHON VIVA QUESTIONS

Q 1) What is python?
Ans. Python is a high level, general-purpose programming language that
can be used to create a variety of programs.
Q 2) Who implemented python?
Ans. Guido Van Rossum in the year 1991.
Q 3) What are the applications of python?
Ans. Web development, Software Development, Machine learning and
Artificial Intelligence, build games, perform scientific computations etc
Q 4) What are the features of python?
Ans. 1) Free and open source
2)Interpreted Language
3) Simple Syntax
4) Case Sensitive Language
5) Platform independent programming language it means it can be
used on any machine and any operating system.
Q 5) What is the difference between a compiler and interpreter?
Ans. A compiler scans the entire program and translates it as a whole into
machine code. Interpreter translates program one statement at a time.
Q 7)What are two working modes of python
Ans. 1) Interactive Mode- instructions are executed line by line
2) Script Mode- instructions are saved as program and then executed.
Q 8) What are conditional statements in python ?
Ans. If-Else statements in Python are part of conditional statements, which
decide the control of code.

Q 9) What is a variable?
Ans. Variables are named storage location that hold some values and it changes
its values during program execution.

Q 10) What are looping statements in python?


Ans There are two looping statements for and while loop
In Python, a while loop is used to execute a block of statements repeatedly
until a given condition is satisfied. When the condition becomes false, the
line immediately after the loop in the program is executed.

For loops are used for sequential traversal. For example: traversing
a list or string or array etc.

Q 11) What are data types in python?

Ans. In computer programming, data types specify the type of data that
can be stored inside a variable.

Data Types Classes Description

Numeric int, float, complex holds numeric values

String str holds sequence of characters

Sequence list, tuple, range holds collection of items

Mapping dict holds data in key-value pair form

Boolean bool holds either True or False

Set set, frozenset hold collection of unique items


Q 12) What is a list in python?
Ans. Python lists store multiple data together in a single variable. They are
created using square bracket [ ]

Each element in a list is associated with a number, known as a list index.


The index always starts from 0, meaning the first element of a list is at
index 0, the second element is at index 1, and so on.

Q 13) What is a max() function in python?


Ans. The max() function returns the largest item in an iterable. It can also be
used to find the largest item between two or more parameters.

Q 14) What is a len() function in python?

Ans. The len() function returns the number of items (length) in an object.
Example

languages = ['Python', 'Java', 'JavaScript']

# compute the length of languages


length = len(languages)

print(length)

# Output: 3

Q 15) What is append() function in python?

Ans. The append() method adds an item to the end of the list.
Example

currencies = ['Dollar', 'Euro', 'Pound']


# append 'Yen' to the list
currencies.append('Yen')
# Output: ['Dollar', 'Euro', 'Pound', 'Yen']

You might also like