Quantcast
Channel: Learn CBSE
Viewing all articles
Browse latest Browse all 11329

Introduction to Python Class 9 AI MCQ Online Test

$
0
0

Students find these Class 9 AI MCQ Chapter 7 Introduction to Python Class 9 AI MCQ Online Test with Answers helpful for self-assessment and preparation.

Class 9 AI Introduction to Python MCQ

MCQ on Introduction to Python Class 9

Class 9 Introduction to Python MCQ – Introduction to Python MCQ Class 9

Multiple Choice Questions

Question 1.
Python is based on
(a) ABC language
(b) Modula 3
(c) Both (a) and (b)
(d) None of these
Answer:
(c) Both (a) and (b)

Question 2.
Python was initially designed by
(a) Guido Van Rossum
(b) Charles Babbage
(c) Grace Hopper
(d) Dennis Ritchie
Answer:
(a) Guido Van Rossum

Question 3.
Which of the following is/are advantage(s) of Python?
(a) Easy to use
(b) Object oriented
(c) Portability
(d) All of these
Answer:
(d) All of these

Introduction to Python Class 9 AI MCQ Online Test

Question 4.
The extension of Python files is
(a) .pyth
(b) python
(c) py
(d) p
Answer:
(c) py

Question 5.
Python interpreters are available for operating system(s)
(a) Windows
(b) MacOS
(c) Both (a) and (b)
(d) None of these
Answer:
(c) Both (a) and (b)

Question 6.
In Python programming, which is considered as keyword?
(a) var
(b) data
(c) time
(d) and
Answer:
(d) and

Question 7.
When writing a program, which elements belong to the character set used in coding?
(a) Alphabets (A-Z, a-z)
(b) Digits (0-9)
(c) Special characters (!, @, #, etc.)
(d) All of the above
Answer:
(d) All of the above

Introduction to Python Class 9 AI MCQ Online Test

Question 8.
In programming languages, which of the following are examples of data types?
i. Integer
ii. Float
iii. Character
iv. Loop
(a) Only i and ii
(b) i, ii, and iii
(c) ii, iii, and iv
(d) Only iii
Answer:
(a) Only i and ii

Question 9.
When writing a computer program, which of the following are used to store information?
i. Variables
ii. Datatypes
iii. Type conversion
iv. Comments
(a) Only i
(b) i and ii
(c) ii and iii
(d) i, ii, and iii
Answer:
(b) i and ii

Question 10.
Which of the following is a valid character in Python?
(a) @
(b) #
(c) $
(d) All of these
Answer:
(d) All of these

Question 11.
Which character is used to indicate the start of a string in Python?
(a) ”
(b) ‘
(c) Both (a) and (b)
(d) None of these
Answer:
(c) Both (a) and (b)

Introduction to Python Class 9 AI MCQ Online Test

Question 12.
How do you write a single line comment in Python?
(a) //
(b) ##
(c) /*
(d) #
Answer:
(d) #

Question 13.
Which of the following is used for multiline comments in Python?
(a) ”’Comment”’
(b) ” ” ” Comment ” ” ”
(c) Both (a) and (b)
(d) None of these
Answer:
(c) Both (a) and (b)

Question 14.
Which of the following is not a keyword in Python?
(a) pass
(b) eval
(c) assert
(d) raise
Answer:
(b) eval

Question 15.
What is the keyword used to define a function in Python?
(a) function
(b) def
(c) func
(d) define
Answer:
(b) def

Introduction to Python Class 9 AI MCQ Online Test

Question 16.
Which-of the following is a valid Python identifier?
(a) 123 var
(b) $var
(c) var 123
(d) var 123
Answer:
(c) var 123

Question 17.
Which of the following is not allowed in a Python identifier?
(a) Numbers
(b) Letters
(c) Underscore ( _)
(d) Hyphen
Answer:
(d) Hyphen

Question 18.
Which of the following is the correct way to declare a variable in Python?
(a) int x = 5
(b) x: = 5
(c) x = 5
(d) declare x = 5
Answer:
(c) x = 5

Question 19.
What will be the output of the following code snippet?
x=10
y=20
x, y = y, x
print(x, y)
(a) 1020
(b) 2010
(c) 1010
(d) 2020
Answer:
(b) 2010

Question 20.
Which of the following is an immutable data type in Python?
(a) List
(b) Dictionary
(c) Set
(d) Tuple
Answer:
(d) Tuple

Introduction to Python Class 9 AI MCQ Online Test

Question 21.
What is the datatype of the variable ” x ” in the following code?
x=3.14
(a) int
(b) float
(c) double
(d) complex
Answer:
(b) float

Question 22.
Which function is used to convert a string to an integer in Python?
(a) str()
(b) int()
(c) float()
(d) eval()
Answer:
(b) int()

Question 23.
What will be the output of the following code snippet?
x = “123”
y = int(x)
print(y+1)
(a) 1231
(b) 124
(c) 123
(d) Error
Answer:
(b) 124

Question 24.
Which of the following is the correct escape sequence for a newline character in Python?
(a) \n
(b) \t
(c) \r
(d) \b
Answer:
(a) \n

Introduction to Python Class 9 AI MCQ Online Test

Question 25.
What will be the output of the following code snippet? print(“Hello\tWorld”)
(a) Hello World
(b) HelloltWorld
(c) Hello World
(d) Error
Answer:
(c) Hello World

Question 26.
Which of the following is the correct operator for exponentiation in Python?
(a) **
(b) .
(c) *
(d) Exp
Answer:
(a) **

Question 27.
What will be the output of the following code snippet?
x = 10
y = 3
print(x // y)
(a) 3.333
(b) 3.0
(c) 3
(d) 4
Answer:
(c) 3

Question 28.
Which function is used to take input from the user in Python?
(a) input() ,
(b) raw_input()
(c) scan()
(d) get()
Answer:
(a) input() ,

Question 29.
What will be the output of the following code snippet?
name = “John”
age = 30
print(f”My name is {name} and I am {age} years old.”)
(a) My name is John and I am 30 years old.
(b) My name is {name} and I am {age} years old.
(c) My name is John and I am years old.
(d) My name is and I am 30 years old.
Answer:
(a) My name is John and I am 30 years old.

Question 30.
These operators are used to make a decision on two conditions.
(a) Logical
(b) Arithmetic
(c) Relational
(d) Assignment
Answer:
(a) Logical

Introduction to Python Class 9 AI MCQ Online Test

Question 31.
Which data type contains only numeric value in Python?
(a) Numbers
(b) Strings
(c) Lists
(d) Tuples
Answer:
(a) Numbers

Question 32.
Which of the following are sequence of character data?
(a) Lists
(b) Tuples
(c) Strings
(d) Dictionaries
Answer:
(c) Strings

Question 33.
In complex number, a+ib, where b represents as
(a) real part
(b) imaginary part
(c) special part
(d) None of the above
Answer:
(b) imaginary part

Question 34.
Which of the following is/are expression?
(a) Arithmetic
(b) Logical
(c) Relational
(d) All of the above
Answer:
(d) All of the above

Statement Based Questions

Question 1.
Statement 1: Python is a high-level programming language.
Statement 2 : Python was created by Guido van Rossum.
(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
Answer:
(a) Both Statement 1 and Statement 2 are correct

Question 2.
Statement 1 : Python code is compiled before it is executed.
Statement 2 : Python uses an interpreter to execute code line by line.
(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
Answer:
(d) Statement 2 is correct but Statement 1 is incorrect

Introduction to Python Class 9 AI MCQ Online Test

Question 3.
Statement 1 : Python is used for web development.
Statement 2 : Python cannot be used for scientific computing.
(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
Answer:
(c) Statement 1 is correct but Statement 2 is incorrect

Question 4.
Statement 1: Python has a simple syntax that is easy to learn.
Statement 2 : Python is platform-independent, meaning it can run on different operating systems.
(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
Answer:
(a) Both Statement 1 and Statement 2 are correct

Question 5.
Statement 1: Python is widely used in AI and machine learning applications.
Statement 2 : Python does not have libraries for AI development.
(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
Answer:
(c) Statement 1 is correct but Statement 2 is incorrect

Question 6.
Statement 1 Keywords in Python are case sensitive.
Statement 2 The keyword “True” is used to represent a boolean value in Python.
(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.
Answer:
(a) Both Statement 1 and Statement 2 are correct.

Introduction to Python Class 9 AI MCQ Online Test

Question 7.
Statement 1 Identifiers can begin with a digit.
Statement 2 Identifiers in Python are case sensitive.
(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.
Answer:
(d) Statement 2 is correct but Statement 1 is incorrect.

Question 8.
Statement 1 A variable in Python must be declared with a specific data type.
Statement 2 The value of a variable can change during program execution.
(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.
Answer:
(d) Statement 2 is correct but Statement 1 is incorrect.

Question 9.
Statement 1 Operators are symbols that perform operations on variables and values.
Statement 2 The assignment operator is denoted by the symbol ” == “.
(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
Answer:
(c) Statement 1 is correct but Statement 2 is incorrect

Question 10.
Statement 1 The print() function is used for output in Python programming.
Statement 2 The input() function is used for input from user in Python programming.
(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
Answer:
(a) Both Statement 1 and Statement 2 are correct

Assertion & Reason Based Questions

Question 1.
Assertion (A): Python is an interpreted language.
Reason ( R ): Python code is executed line by line at runtime by the Python interpreter.
(a) Both A and R are correct and R is the correct explanation of A.
(b) Both A and R are correct but R is not the correct explanation of A.
(c) A is correct but R is incorrect.
(d) A is incorrect but R is correct.
Answer:
(a) Both A and R are correct and R is the correct explanation of A.

Question 2.
Assertion (A) : Python is an object oriented language.
Reason (R) : In Python, everything is an object.
(a) Both A and R are correct and R is the correct explanation of A.
(b) Both A and R are correct but R is not the correct explanation of A.
(c) A is correct but R is incorrect.
(d) A is incorrect but R is correct.
Answer:
(a) Both A and R are correct and R is the correct explanation of A.

Introduction to Python Class 9 AI MCQ Online Test

Question 3.
Assertion (A) : Python is not a highly readable programming language.
Reason (R): Python uses indentation to define the structure of the code, making it easy to read and understand.
(a) Both A and R are correct and R is the correct explanation of A.
(b) Both A and R are correct but R is not the correct explanation of A.
(c) A is correct but R is incorrect.
(d) A is incorrect but R is correct.
Answer:
(d) A is incorrect but R is correct.

Question 4.
Assertion (A): Python is a high level language.
Reason (R): Python code can be easily understand by humans.
(a) Both A and R are correct and R is the correct explanation of A.
(b) Both A and R are correct but R is not the correct explanation of A.
(c) A is correct but R is incorrect.
(d) A is incorrect but R is correct.
Answer:
(a) Both A and R are correct and R is the correct explanation of A.

Question 5.
Assertion (A) The character set of a programming language determines the valid characters that can be used in source code.
Reason (R) Character sets ensure that programming languages can handle different types of data, such as numbers, letters, and symbols.
(a) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A).
(b) Both Assertion (A) and Reason (R) arè true, but Reason (R) is not the correct explanation of Assertion (A).
(c) Assertion (A) is true, but Reason (R) is false.
(d) Assertion (A) is false, but Reason (R) is true.
Answer:
(a) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A).

Question 6.
Assertion (A) Comments in a program can affect the execution of the code.
Reason (R) Comments are used to explain and clarify the code, making it easier for programmers to understand.
(a) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A).
(b) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A).
(c) Assertion (A) is true, but Reason (R) is false.
(d) Assertion (A) is false, but Reason (R) is true.
Answer:
(d) Assertion (A) is false, but Reason (R) is true.

Introduction to Python Class 9 AI MCQ Online Test

Question 7.
Assertion (A) Keywords are predefined reserved words in a programming language.
Reason (R) Keywords can be used as variable names in a program.
(a) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A).
(b) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A).
(c) Assertion (A) is true, but Reason (R) is false.
(d) Assertion (A) is false, but Reason (R) is true.
Answer:
(c) Assertion (A) is true, but Reason (R) is false.

Question 8.
Assertion (A) Datatypes specify the type of data that a variable can hold.
Reason (R) Using the correct datatype is important for ensuring the efficient use of memory and proper data operations.
(a) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A).
(b) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A).
(c) Assertion (A) is true, but Reason (R) is false.
(d) Assertion (A) is false, but Reason (R) is true.
Answer:
(a) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A).

The post Introduction to Python Class 9 AI MCQ Online Test appeared first on Learn CBSE.


Viewing all articles
Browse latest Browse all 11329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>