CBSE/Karnataka PU Board PUC I Chapter 5 "Getting Started with Python"

 


CBSE/Karnataka PU Board PUC I Chapter 5 "Getting Started with Python"

50 MCQ questions :

  1. Python is classified as a:
    A. Low-level language
    B. High-level language
    C. Assembly language
    D. Machine code
    Answer: B

  2. Which symbol is used to start a comment in Python?
    A. //
    B. <!--
    C. #
    D. /*
    Answer: C

  3. Which of the following is not a Python keyword?
    A. def
    B. class
    C. function
    D. return
    Answer: C

  4. Which function is used to display output on the screen?
    A. echo()
    B. print()
    C. display()
    D. write()
    Answer: B

  5. The correct syntax to take user input is:
    A. get()
    B. receive()
    C. input()
    D. scan()
    Answer: C

  6. Python is a case-sensitive language.
    A. True
    B. False
    Answer: A

  7. What is the output of print(2 + 3 * 4)?
    A. 20
    B. 14
    C. 24
    D. 10
    Answer: B

  8. Which of the following is a valid variable name?
    A. sum
    B. 2data
    C. user-name
    D. for
    Answer: A

  9. Python scripts are saved with the extension:
    A. .py
    B. .pt
    C. .python
    D. .p
    Answer: A

  10. What type of language is Python?
    A. Compiled
    B. Markup
    C. Interpreted
    D. Assembler
    Answer: C

  11. To get the remainder in division, which operator is used?
    A. //
    B. %
    C. /
    D. **
    Answer: B

  12. The result of 5 // 2 in Python is:
    A. 2.5
    B. 2
    C. 3
    D. 2.0
    Answer: B

  13. Select the immutable type in Python:
    A. List
    B. Dictionary
    C. Tuple
    D. Set
    Answer: C

  14. What is the output of type(3.0)?
    A. 'integer'
    B. 'float'
    C. 'decimal'
    D. 'double'
    Answer: B

  15. Which function converts a string to an integer?
    A. str()
    B. float()
    C. int()
    D. to_int()
    Answer: C

  16. A block of code in Python is defined by:
    A. Parentheses
    B. Braces
    C. Indentation
    D. Semicolons
    Answer: C

  17. Which operator is used for exponentiation in Python?
    A. ^
    B. **
    C. %
    D. x
    Answer: B

  18. The keyword to define a function in Python is:
    A. func
    B. function
    C. def
    D. sub
    Answer: C

  19. The assignment operator in Python is:
    A. ==
    B. :=
    C. =
    D. =>
    Answer: C

  20. a, b = 5, 10 means:
    A. a=5, b=10
    B. a=10, b=5
    C. Syntax error
    D. a=5*10
    Answer: A

  21. Which data type is mutable?
    A. Tuple
    B. String
    C. List
    D. Integer
    Answer: C

  22. What does input("Enter number: ") return?
    A. Integer
    B. Float
    C. String
    D. Boolean
    Answer: C

  23. To get a value from user and store as float, use:
    A. input()
    B. float(input())
    C. str(input())
    D. get.float()
    Answer: B

  24. Which is not a primitive data type in Python?
    A. int
    B. float
    C. str
    D. array
    Answer: D

  25. The output of print(4**2) is:
    A. 8
    B. 16
    C. 22
    D. 6
    Answer: B

  26. To join strings, use:
    A. +
    B. *
    C. -
    D. /
    Answer: A

  27. What is the result of "5" + 2?
    A. 7
    B. 52
    C. Error
    D. "7"
    Answer: C

  28. Which is used to exit the program in Python?
    A. stop
    B. quit()
    C. end
    D. close()
    Answer: B

  29. What will print('Hello', end='!') output?
    A. Hello!
    B. Hello
    C. !Hello
    D. Hello !
    Answer: A

  30. What is the output type of input() function?
    A. Integer
    B. Float
    C. String
    D. List
    Answer: C

  31. Which is NOT a valid variable name?
    A. user1
    B. name_2
    C. _value
    D. 3rdvalue
    Answer: D

  32. The // operator denotes:
    A. Division with remainder
    B. Floor division
    C. Exponentiation
    D. String joining
    Answer: B

  33. 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

  34. An error in code before execution is:
    A. Logical error
    B. Runtime error
    C. Syntax error
    D. Output error
    Answer: C

  35. print(5, 6, sep='@') will output:
    A. 5@6
    B. 5 6
    C. 56
    D. 5@ 6
    Answer: A

  36. input() returns data as:
    A. String
    B. Integer
    C. Float
    D. Boolean
    Answer: A

  37. Which of these is not a valid comment in Python?
    A. # Hello
    B. // Hello
    C. '''Hello'''
    D. """Hello"""
    Answer: B

  38. The output of len("Python") is:
    A. 7
    B. 5
    C. 6
    D. 8
    Answer: C

  39. The escape character in Python is:
    A. %
    B. \
    C. $
    D. /
    Answer: B

  40. The function to find data type of a variable is:
    A. check()
    B. datatype()
    C. type()
    D. class()
    Answer: C

  41. Which keyword is used for conditional execution?
    A. if
    B. loop
    C. check
    D. switch
    Answer: A

  42. What value does input("Data: ") return if user enters nothing and presses Enter?
    A. None
    B. ' ' (empty string)
    C. 0
    D. Error
    Answer: B

  43. The result of int("7") + float("5.5") is:
    A. "12.5"
    B. 12
    C. 12.5
    D. "75.5"
    Answer: C

  44. Immutable data type among these:
    A. List
    B. Set
    C. String
    D. Dictionary
    Answer: C

  45. Which keyword is used to skip rest of loop and go to next iteration?
    A. skip
    B. continue
    C. jump
    D. break
    Answer: B

  46. To print without newline in Python:
    A. print()
    B. print('', end='')
    C. print(end='')
    D. B and C both
    Answer: D

  47. Which of these is not a logical operator in Python?
    A. and
    B. or
    C. not
    D. nor
    Answer: D

  48. Which expression checks if x is NOT 10?
    A. x =! 10
    B. x != 10
    C. x == 10
    D. x not 10
    Answer: B

  49. type([1][2][3]) returns:
    A. 'tuple'
    B. 'list'
    C. 'int'
    D. 'set'
    Answer: B

  50. 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 :

  1. What is Python?
    Answer: A high-level programming language.

  2. Which symbol starts a comment in Python?
    Answer: #

  3. How do you display output in Python?
    Answer: By using the print() function.

  4. What is the extension for Python files?
    Answer: .py

  5. How do you take user input in Python?
    Answer: input() function

  6. Python is case-sensitive. (True/False)
    Answer: True

  7. What is the assignment operator in Python?
    Answer: =

  8. Which keyword is used to define a function in Python?
    Answer: def

  9. What is the output type of input() function?
    Answer: String

  10. Which operator gives the remainder?
    Answer: %

  11. How do you represent strings in Python?
    Answer: By enclosing text in quotes (‘ ’ or “ ”)

  12. What is the result of 3 + 7 in Python?
    Answer: 10

  13. Which function returns the data type of a variable?
    Answer: type()

  14. Which operator is used for exponentiation in Python?
    Answer: **

  15. Give one example of a mutable data type in Python.
    Answer: List

  16. Which function converts data to integer type?
    Answer: int()

  17. Is tuple mutable or immutable?
    Answer: Immutable

  18. How do you indicate a block of code in Python?
    Answer: Indentation

  19. Which statement is used for conditional execution?
    Answer: if

  20. What is the value of 4 // 2 in Python?
    Answer: 2

2 marks questions with answers

  1. 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.

  2. What is a data type? Give two examples.
    Answer:
    A data type specifies the kind of value a variable holds. Examples: int, float.

  3. 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.

  4. Name two immutable data types in Python.
    Answer:
    Tuple and string.

  5. What is the difference between // and / operators?
    Answer:
    // gives floor division (integer result), / gives float division (decimal result).

  6. How can you print on the same line in Python?
    Answer:
    By using the end parameter in print(), e.g., print("Hello", end=" ").

  7. Give two uses of the input() function.
    Answer:
    It reads strings from the user and can be used for interactive data entry.

  8. 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).

  9. What will the expression int("5") + float("4.2") output?
    Answer:
    9.2

  10. Explain mutable and immutable types with examples.
    Answer:
    Mutable: list (can change after creation). Immutable: string (cannot change after creation).

  11. How can you make comments in Python?
    Answer:
    Using # for single-line comments, or triple quotes for multi-line documentation.

  12. 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).

  13. What does the len() function do?
    Answer:
    Returns the length (number of items) of a string or list.

  14. Explain the difference between int() and float() functions.
    Answer:
    int() converts values to integer type; float() converts values to floating-point (decimal) type.

  15. What are keywords? Give two examples.
    Answer:
    Reserved words with special meaning in Python. Examples: if, while.

  16. How can you find the type of a value in Python?
    Answer:
    By using the type() function, e.g., type(5).

  17. What is the difference between print('A'*3) and print('A'+3)?
    Answer:
    print('A'*3) outputs 'AAA'; print('A'+3) gives a TypeError.

  18. Why should you use indentation in Python?
    Answer:
    Indentation defines blocks of code and ensures correct program structure.

  19. How does Python handle string concatenation?
    Answer:
    Uses + operator to join two strings.

  20. 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

  1. 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:").

  2. 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).

  3. 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.

  4. Write a Python program to add two numbers entered by the user.
    Answer:

python
a = int(input("Enter first: ")) b = int(input("Enter second: ")) print("Sum:", a + b)
  1. List three rules for naming variables in Python.
    Answer:

  2. Cannot start with digit

  3. No spaces/special chars except _

  4. Cannot use keywords

  5. Explain the difference between ‘/’ and ‘//’ division in Python with an example.
    Answer: / gives float (5/2 = 2.5); // gives integer (5//2 = 2).

  6. 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.

  7. 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.

  8. Define and provide examples of three Python keywords.
    Answer: Keywords are reserved words. Examples: if, def, return.

  9. 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 product

  10. Write a program to accept the radius and print the area of a circle.
    Answer:

python
r = float(input("Enter radius: ")) print("Area:", 3.14 * r * r)
  1. 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+1

  2. How can you concatenate two strings in Python? Demonstrate with code.
    Answer: "Hello " + "World" gives "Hello World".

  3. Explain three features of Python as a programming language.
    Answer:

  4. Interpreted

  5. High-level

  6. Supports dynamic typing

  7. 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.

  8. Illustrate the use of comments in Python and their importance.
    Answer: Use # for comments; helps others understand logic and avoids confusion.

  9. Write a program to convert Celsius to Fahrenheit.
    Answer:

python
c = float(input("Enter Celsius: ")) print("Fahrenheit:", c*9/5 + 32)
  1. List three methods to handle user input safely in Python.
    Answer:

  2. Use try/except for errors

  3. Convert types before operations

  4. Check for empty input

  5. Show with code how floor division can be useful in real-world problems.
    Answer:
    For dividing people into groups:

python
groups = 23 // 4 # returns 5
  1. 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

CHAPTER 1 

CHAPTER 2

CHAPTER 3

CHAPTER 4

[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]

Comments