CBSE/Karnataka PU Board PUC I Chapter 5 "Getting Started with Python"
50 MCQ questions :
-
Python is classified as a:
A. Low-level language
B. High-level language
C. Assembly language
D. Machine code
Answer: B -
Which symbol is used to start a comment in Python?
A. //
B. <!--
C. #
D. /*
Answer: C -
Which of the following is not a Python keyword?
A. def
B. class
C. function
D. return
Answer: C -
Which function is used to display output on the screen?
A. echo()
B. print()
C. display()
D. write()
Answer: B -
The correct syntax to take user input is:
A. get()
B. receive()
C. input()
D. scan()
Answer: C -
Python is a case-sensitive language.
A. True
B. False
Answer: A -
What is the output of
print(2 + 3 * 4)?
A. 20
B. 14
C. 24
D. 10
Answer: B -
Which of the following is a valid variable name?
A. sum
B. 2data
C. user-name
D. for
Answer: A -
Python scripts are saved with the extension:
A. .py
B. .pt
C. .python
D. .p
Answer: A -
What type of language is Python?
A. Compiled
B. Markup
C. Interpreted
D. Assembler
Answer: C -
To get the remainder in division, which operator is used?
A. //
B. %
C. /
D. **
Answer: B -
The result of
5 // 2in Python is:
A. 2.5
B. 2
C. 3
D. 2.0
Answer: B -
Select the immutable type in Python:
A. List
B. Dictionary
C. Tuple
D. Set
Answer: C -
What is the output of
type(3.0)?
A. 'integer'
B. 'float'
C. 'decimal'
D. 'double'
Answer: B -
Which function converts a string to an integer?
A. str()
B. float()
C. int()
D. to_int()
Answer: C -
A block of code in Python is defined by:
A. Parentheses
B. Braces
C. Indentation
D. Semicolons
Answer: C -
Which operator is used for exponentiation in Python?
A. ^
B. **
C. %
D. x
Answer: B -
The keyword to define a function in Python is:
A. func
B. function
C. def
D. sub
Answer: C -
The assignment operator in Python is:
A. ==
B. :=
C. =
D. =>
Answer: C -
a, b = 5, 10means:
A. a=5, b=10
B. a=10, b=5
C. Syntax error
D. a=5*10
Answer: A -
Which data type is mutable?
A. Tuple
B. String
C. List
D. Integer
Answer: C -
What does
input("Enter number: ")return?
A. Integer
B. Float
C. String
D. Boolean
Answer: C -
To get a value from user and store as float, use:
A. input()
B. float(input())
C. str(input())
D. get.float()
Answer: B -
Which is not a primitive data type in Python?
A. int
B. float
C. str
D. array
Answer: D -
The output of
print(4**2)is:
A. 8
B. 16
C. 22
D. 6
Answer: B -
To join strings, use:
A. +
B. *
C. -
D. /
Answer: A -
What is the result of
"5" + 2?
A. 7
B. 52
C. Error
D. "7"
Answer: C -
Which is used to exit the program in Python?
A. stop
B. quit()
C. end
D. close()
Answer: B -
What will
print('Hello', end='!')output?
A. Hello!
B. Hello
C. !Hello
D. Hello !
Answer: A -
What is the output type of
input()function?
A. Integer
B. Float
C. String
D. List
Answer: C -
Which is NOT a valid variable name?
A. user1
B. name_2
C. _value
D. 3rdvalue
Answer: D -
The
//operator denotes:
A. Division with remainder
B. Floor division
C. Exponentiation
D. String joining
Answer: B -
A function that displays something but returns nothing is called:
A. Value function
B. Non-value function
C. Void function
D. None function
Answer: C -
An error in code before execution is:
A. Logical error
B. Runtime error
C. Syntax error
D. Output error
Answer: C -
print(5, 6, sep='@')will output:
A. 5@6
B. 5 6
C. 56
D. 5@ 6
Answer: A -
input()returns data as:
A. String
B. Integer
C. Float
D. Boolean
Answer: A -
Which of these is not a valid comment in Python?
A. # Hello
B. // Hello
C. '''Hello'''
D. """Hello"""
Answer: B -
The output of
len("Python")is:
A. 7
B. 5
C. 6
D. 8
Answer: C -
The escape character in Python is:
A. %
B. \
C. $
D. /
Answer: B -
The function to find data type of a variable is:
A. check()
B. datatype()
C. type()
D. class()
Answer: C -
Which keyword is used for conditional execution?
A. if
B. loop
C. check
D. switch
Answer: A -
What value does
input("Data: ")return if user enters nothing and presses Enter?
A. None
B. ' ' (empty string)
C. 0
D. Error
Answer: B -
The result of
int("7") + float("5.5")is:
A. "12.5"
B. 12
C. 12.5
D. "75.5"
Answer: C -
Immutable data type among these:
A. List
B. Set
C. String
D. Dictionary
Answer: C -
Which keyword is used to skip rest of loop and go to next iteration?
A. skip
B. continue
C. jump
D. break
Answer: B -
To print without newline in Python:
A. print()
B. print('', end='')
C. print(end='')
D. B and C both
Answer: D -
Which of these is not a logical operator in Python?
A. and
B. or
C. not
D. nor
Answer: D -
Which expression checks if x is NOT 10?
A. x =! 10
B. x != 10
C. x == 10
D. x not 10
Answer: B -
type([1][2][3])returns:
A. 'tuple'
B. 'list'
C. 'int'
D. 'set'
Answer: B -
Which is used to input multi-word string in a single line?
A. input()
B. cin
C. scan()
D. gets()
Answer: A
1 mark questions with answers :
-
What is Python?
Answer: A high-level programming language. -
Which symbol starts a comment in Python?
Answer: # -
How do you display output in Python?
Answer: By using the print() function. -
What is the extension for Python files?
Answer: .py -
How do you take user input in Python?
Answer: input() function -
Python is case-sensitive. (True/False)
Answer: True -
What is the assignment operator in Python?
Answer: = -
Which keyword is used to define a function in Python?
Answer: def -
What is the output type of input() function?
Answer: String -
Which operator gives the remainder?
Answer: % -
How do you represent strings in Python?
Answer: By enclosing text in quotes (‘ ’ or “ ”) -
What is the result of 3 + 7 in Python?
Answer: 10 -
Which function returns the data type of a variable?
Answer: type() -
Which operator is used for exponentiation in Python?
Answer: ** -
Give one example of a mutable data type in Python.
Answer: List -
Which function converts data to integer type?
Answer: int() -
Is tuple mutable or immutable?
Answer: Immutable -
How do you indicate a block of code in Python?
Answer: Indentation -
Which statement is used for conditional execution?
Answer: if -
What is the value of 4 // 2 in Python?
Answer: 2
2 marks questions with answers
-
Define a variable in Python.
Answer:
A variable is a name given to a memory location that stores a value which can change during program execution. -
What is a data type? Give two examples.
Answer:
A data type specifies the kind of value a variable holds. Examples: int, float. -
How does Python handle type conversion automatically?
Answer:
Python converts values automatically during operations (implicit conversion), e.g., int to float when an int and a float are added. -
Name two immutable data types in Python.
Answer:
Tuple and string. -
What is the difference between
//and/operators?
Answer:
//gives floor division (integer result),/gives float division (decimal result). -
How can you print on the same line in Python?
Answer:
By using the end parameter in print(), e.g., print("Hello", end=" "). -
Give two uses of the input() function.
Answer:
It reads strings from the user and can be used for interactive data entry. -
What is syntax error? Give one example.
Answer:
A syntax error is a mistake in the rules of a programming language. Example: print("Hello' (missing closing quote). -
What will the expression
int("5") + float("4.2")output?
Answer:
9.2 -
Explain mutable and immutable types with examples.
Answer:
Mutable: list (can change after creation). Immutable: string (cannot change after creation). -
How can you make comments in Python?
Answer:
Using # for single-line comments, or triple quotes for multi-line documentation. -
Why are variable names case-sensitive in Python?
Answer:
Because Python treats upper and lower case letters as different (e.g., var and Var are different). -
What does the len() function do?
Answer:
Returns the length (number of items) of a string or list. -
Explain the difference between int() and float() functions.
Answer:
int() converts values to integer type; float() converts values to floating-point (decimal) type. -
What are keywords? Give two examples.
Answer:
Reserved words with special meaning in Python. Examples: if, while. -
How can you find the type of a value in Python?
Answer:
By using the type() function, e.g., type(5). -
What is the difference between print('A'*3) and print('A'+3)?
Answer:
print('A'*3) outputs 'AAA'; print('A'+3) gives a TypeError. -
Why should you use indentation in Python?
Answer:
Indentation defines blocks of code and ensures correct program structure. -
How does Python handle string concatenation?
Answer:
Uses+operator to join two strings. -
What happens if you use input() without type conversion for numbers?
Answer:
The value is read as a string, so numeric operations may give errors or incorrect results.
3 marks questions with answers
Explain the use of the print() and input() functions in Python with examples.
Answer: print() displays output; e.g., print("Hello"). input() allows user input; e.g., x = input("Enter:").Describe the difference between mutable and immutable data types, giving two examples of each.
Answer: Mutable data can change after creation (e.g., list, dictionary). Immutable cannot (e.g., string, tuple).How does Python perform type conversion? Illustrate with a code example.
Answer: Python uses int(), float(), str() for explicit conversion. Example: int("7") + float("3.5") → 10.5.Write a Python program to add two numbers entered by the user.
Answer:
pythona = int(input("Enter first: ")) b = int(input("Enter second: ")) print("Sum:", a + b)
List three rules for naming variables in Python.
Answer:Cannot start with digit
No spaces/special chars except _
Cannot use keywords
Explain the difference between ‘/’ and ‘//’ division in Python with an example.
Answer:/gives float (5/2 = 2.5);//gives integer (5//2 = 2).What is indentation in Python? Why is it important?
Answer: Indentation refers to spaces added to start of code lines. It defines code blocks and is mandatory for correct logic.How would you check the data type of a variable and what is its significance?
Answer: Use type(x). Knowing type helps in conversion/operation and avoids errors.Define and provide examples of three Python keywords.
Answer: Keywords are reserved words. Examples: if, def, return.Distinguish between syntax error and logical error with code examples.
Answer:
Syntax error: print("Hello) (no closing quote)
Logical error: print(2 * 2) if expecting sum, not productWrite a program to accept the radius and print the area of a circle.
Answer:
pythonr = float(input("Enter radius: ")) print("Area:", 3.14 * r * r)
What does the len() function do? Give two examples of its usage.
Answer: Length of an object, e.g., len("hi") → 2, len() → 3.kecs102.pdf+1How can you concatenate two strings in Python? Demonstrate with code.
Answer: "Hello " + "World" gives "Hello World".Explain three features of Python as a programming language.
Answer:Interpreted
High-level
Supports dynamic typing
What are the steps in writing and running a basic Python program?
Answer: Write code in .py file, save, run with Python interpreter, debug if errors found.Illustrate the use of comments in Python and their importance.
Answer: Use # for comments; helps others understand logic and avoids confusion.Write a program to convert Celsius to Fahrenheit.
Answer:
pythonc = float(input("Enter Celsius: ")) print("Fahrenheit:", c*9/5 + 32)
List three methods to handle user input safely in Python.
Answer:Use try/except for errors
Convert types before operations
Check for empty input
Show with code how floor division can be useful in real-world problems.
Answer:
For dividing people into groups:
pythongroups = 23 // 4 # returns 5
Explain why Python is widely used for beginners in computer science.
Answer: Simple syntax, clear structure, large community, easy to debug, free/open-source.
PREVIOUS CHAPTER QUESTION BANK CLICK BELOW
[NOTE: Kindly cross check answers once from other source also, Quantity and Quality of answers also kindly check before use, specially 5 marks answers are not sufficient kindly add from your side, this gives just quick review]
.png)
Comments
Post a Comment