Back to Tutorials
TutorialsISCClass 11Python

Python Practice Questions and Solved Programs for ICSE and ISC Students

Test your Python skills with output prediction questions, error-finding exercises, solved programs, and MCQ-style questions designed for ICSE and ISC board examinations.

Trushna Tejwani13 April 202615 min read
Python Practice Questions and Solved Programs for ICSE and ISC Students

Welcome to Part 3 of our Python for ICSE and ISC Students series! In Part 1, you learned what Python is and wrote your first program. In Part 2, you mastered variables, data types, and operators. Now it is time to put all that knowledge to the test.

This tutorial contains the types of questions that frequently appear in ICSE and ISC board examinations. Practice each section carefully and try to solve the questions on your own before looking at the answers.

Section A: Predict the Output

Read each code snippet carefully and predict what it will print. These questions test your understanding of how Python evaluates expressions.

Question 1

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Answer:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Explanation: The / operator performs regular division and always returns a float. The // operator performs floor division (removes the decimal). The % operator gives the remainder when 10 is divided by 3.

Question 2

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Answer:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Explanation: The + operator concatenates strings. The * operator repeats a string. The len() function returns the number of characters.

Question 3

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Answer: 12

Explanation: Step by step: x = 5, then x = 5 + 3 = 8, then x = 8 * 2 = 16, then x = 16 - 4 = 12.

Question 4

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Answer:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Explanation: The and operator returns True only when both values are True. The or operator returns True when at least one is True. The not operator reverses the Boolean value. In the last line, not b is True, so True and True gives True.

Question 5

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Answer:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Explanation: Index 1 gives the second item. Index -1 gives the last item. append() adds to the end. Lists are mutable, so we can change fruits[0].

Question 6

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Answer:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Section B: Find the Errors

Each of the following code snippets contains one or more errors. Identify the errors and write the corrected code. These questions test your ability to debug Python programs.

Error Question 1

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Error: input() returns a string. You cannot add an integer (1) to a string. This causes a TypeError.

Corrected code:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Error Question 2

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Error: Variable names cannot start with a digit. This causes a SyntaxError.

Corrected code:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Error Question 3

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Error: Tuples are immutable. You cannot change an item in a tuple. This causes a TypeError.

Corrected code (use a list instead):

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Error Question 4

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Error: You cannot concatenate a string with a float using +. The variable percentage is a float (90.0), not a string.

Corrected code:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Section C: Write the Program

Try writing these programs on your own first, then compare with the solutions below.

Program 1: Temperature Converter

Write a program that takes temperature in Celsius from the user and converts it to Fahrenheit. Formula: F = (C x 9/5) + 32

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Sample output: If user enters 37, it prints: 37.0 degrees Celsius = 98.6 degrees Fahrenheit

Program 2: Check Even or Odd

Write a program that takes a number from the user and checks whether it is even or odd.

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Key concept: A number is even if it leaves no remainder when divided by 2. We check this using the modulus operator (%).

Program 3: Simple Interest Calculator

Write a program that takes principal amount, rate of interest, and time in years from the user and calculates simple interest. Formula: SI = (P x R x T) / 100

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Program 4: Swap Two Numbers

Write a program that swaps the values of two variables without using a third variable.

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Note: Python allows swapping in a single line using a, b = b, a. This is a unique Python feature. In other languages, you would typically need a temporary third variable.

Program 5: Largest of Three Numbers

Write a program that takes three numbers from the user and finds the largest one.

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Alternative approach using max(): Python has a built-in max() function that makes this even simpler.

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Program 6: Student Grade Calculator

Write a program that takes marks of 5 subjects, calculates the total and percentage, and assigns a grade based on the percentage.

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

Section D: Multiple Choice Questions

Test your conceptual understanding with these MCQs. Try to answer each question before reading the answer.

Q1. Which of the following is NOT a valid variable name in Python?

(a) _count (b) my_var (c) 3total (d) Total_3

Answer: (c) 3total — Variable names cannot start with a digit.

Q2. What is the output of print(type(10.0))?

(a) <class 'int'> (b) <class 'float'> (c) <class 'str'> (d) <class 'number'>

Answer: (b) <class 'float'> — The decimal point makes it a float, even if the decimal part is zero.

Q3. What does the // operator do in Python?

(a) Regular division (b) Exponentiation (c) Floor division (d) Modulus

Answer: (c) Floor division — It divides and removes the decimal portion, returning only the integer part.

Q4. Which data type is immutable?

(a) List (b) Dictionary (c) Tuple (d) Set

Answer: (c) Tuple — Once created, items in a tuple cannot be changed, added, or removed.

Q5. What is the result of: 5 + 3 * 2?

(a) 16 (b) 11 (c) 13 (d) 10

Answer: (b) 11 — Python follows BODMAS/PEMDAS. Multiplication is done before addition: 3 * 2 = 6, then 5 + 6 = 11.

Q6. What does input() return in Python?

(a) Integer (b) Float (c) Boolean (d) String

Answer: (d) String — The input() function always returns a string, regardless of what the user types. You must convert it using int() or float() if you need a number.

Bonus Challenge Problems

Try these on your own. Write the complete program in Python IDLE and test it.

  1. Write a program that takes the radius of a circle and prints its area and circumference. (Hint: Area = 3.14159 * r * r, Circumference = 2 * 3.14159 * r)
  2. Write a program that takes a number and checks whether it is positive, negative, or zero.
  3. Write a program that takes marks of a student and checks if the student has passed or failed. The passing mark is 33 out of 100.
  4. Create a dictionary with details of your 3 favourite books (title, author, year). Print each book's details on a separate line.
  5. Write a program that takes a 4-digit number and prints the sum of its digits. (Hint: Use // and % operators)

Series Summary

Congratulations on completing the Python Fundamentals series! Here is what you have learned across all three parts:

  • Part 1: What Python is, how to install it, IDLE, print(), comments, and case sensitivity
  • Part 2: Variables, data types (int, float, str, bool, list, tuple, dict), type conversion, input(), and operators
  • Part 3: Output prediction, error finding, solved programs, and MCQ practice

These concepts form the foundation of Python programming. In upcoming tutorials, we will explore conditional statements (if-elif-else) in greater depth, loops (for and while), functions, and string manipulation. Keep practising, and you will be well-prepared for your board examinations!

Happy coding!