Computer Science

100 Important Questions – Class XI Computer Science Unit 2: Computational Thinking and Programming–1

Class 11 · Computer Science

Unit 2: Computational Thinking and Programming–1

Complete Unit Syllabus

  • Introduction to Problem Solving
    • Problem-solving steps
    • Algorithms
    • Flowcharts
    • Pseudocode
    • Decomposition
  • Introduction to Python
    • Features of Python
    • Interactive and Script modes
    • Python character set
    • Tokens
    • Variables
    • L-value and R-value
    • Comments
  • Data Types
    • Integer
    • Floating Point
    • Complex
    • Boolean
    • String
    • List
    • Tuple
    • None
    • Dictionary
    • Mutable and Immutable Data Types
  • Operators and Expressions
    • Arithmetic operators
    • Relational operators
    • Logical operators
    • Assignment operators
    • Augmented assignment operators
    • Identity operators
    • Membership operators
    • Operator precedence
    • Expression evaluation
  • Input, Output and Type Conversion
  • Errors
    • Syntax errors
    • Logical errors
    • Runtime errors
  • Flow of Control
    • Sequential flow
    • Conditional statements
    • Iterative statements
    • for loop
    • while loop
    • break and continue
    • Nested loops
  • Strings
    • String operations
    • Indexing and slicing
    • Traversing strings
    • String functions and methods
  • Lists
    • Indexing and slicing
    • List operations
    • Traversing lists
    • List functions and methods
    • Nested lists
  • Tuples
    • Indexing
    • Slicing
    • Tuple operations
    • Tuple assignment
    • Nested tuples
  • Dictionaries
    • Key-value pairs
    • Accessing values
    • Dictionary operations
    • Dictionary methods
  • Python Modules
    • Importing modules
    • math module
    • random module
    • statistics module

100 Important Questions

This question bank is designed for revision, classroom practice, periodic tests, term examinations and practical/viva preparation. Questions include definitions, conceptual questions, output-based questions, comparisons, application-based questions and programming situations.

Section 1: Problem Solving and Computational Thinking

Questions 1–10

Q1. What is problem solving?

Answer:

Problem solving is the systematic process of understanding a problem and developing a suitable solution for it.

Q2. What is an algorithm?

Answer:

An algorithm is a finite sequence of clear and step-by-step instructions used to solve a problem.

Q3. Name the major steps involved in problem solving.

Answer:

Analysing the problem, developing an algorithm, coding, testing and debugging.

Q4. What is decomposition?

Answer:

Decomposition is the process of breaking a complex problem into smaller and manageable sub-problems.

Q5. What is a flowchart?

Answer:

A flowchart is a graphical representation of an algorithm using standard symbols and arrows.

Q6. What is pseudocode?

Answer:

Pseudocode is an informal description of an algorithm written using simple language and programming-like statements.

Q7. Why is an algorithm prepared before coding?

Answer:

It provides a logical sequence of steps and helps the programmer understand the solution before writing code.

Q8. What is testing in problem solving?

Answer:

Testing involves executing a program with suitable inputs to check whether it produces the expected output.

Q9. What is debugging?

Answer:

Debugging is the process of identifying and correcting errors in a program.

Q10. Why should a large problem be divided into smaller problems?

Answer:

Smaller problems are easier to understand, solve, test and debug.

Section 2: Introduction to Python

Questions 11–20

Q11. What is Python?

Answer:

Python is a high-level, interpreted, general-purpose programming language.

Q12. Who developed Python?

Answer:

Python was developed by Guido van Rossum.

Q13. Mention any two features of Python.

Answer:

Python has simple syntax and is platform independent.

Q14. What is Interactive Mode in Python?

Answer:

Interactive Mode allows Python statements to be entered and executed one at a time at the Python prompt.

Q15. What is Script Mode?

Answer:

Script Mode allows a complete Python program to be written in a file and executed as a program.

Q16. Differentiate between Interactive Mode and Script Mode.

Interactive Mode Script Mode
Statements are executed one at a time. The complete program is stored in a file.
Useful for quick experimentation. Suitable for developing complete programs.

Q17. What is the Python character set?

Answer:

It is the set of characters that can be used to write Python programs, including letters, digits, special symbols and whitespace characters.

Q18. What is a Python token?

Answer:

A token is the smallest individual unit of a Python program recognised by the interpreter.

Q19. Name the major types of Python tokens.

Answer:

Keywords, identifiers, literals, operators and punctuators.

Q20. What is an identifier?

Answer:

An identifier is a name given to variables, functions, classes or other program elements.

Section 3: Tokens, Variables and Comments

Questions 21–30

Q21. Can an identifier start with a digit?

Answer:

No. An identifier cannot start with a digit.

Q22. Is student_name a valid identifier?

Answer:

Yes. An underscore can be used in an identifier.

Q23. Is 2marks a valid identifier?

Answer:

No. An identifier cannot begin with a digit.

Q24. What are keywords?

Answer:

Keywords are reserved words in Python that have predefined meanings, such as if, else, for and while.

Q25. Can a Python keyword be used as a variable name?

Answer:

No. Keywords are reserved and cannot be used as identifiers.

Q26. What is a literal?

Answer:

A literal is a fixed value directly written in a Python program, such as 25, 3.14 or "Python".

Q27. What is a variable?

Answer:

A variable is a named reference used to store a value during program execution.

Q28. What is an L-value?

Answer:

An L-value refers to an object or variable that can appear on the left side of an assignment.

Q29. What is an R-value?

Answer:

An R-value is the value or expression placed on the right side of an assignment.

Q30. What is the purpose of comments in Python?

Answer:

Comments explain the program and improve readability. They are ignored by the interpreter.

Section 4: Data Types

Questions 31–40

Q31. What is a data type?

Answer:

A data type specifies the kind of value stored by a variable and the operations that can be performed on it.

Q32. Which data type is used for whole numbers?

Answer:

int.

Q33. Which data type is used for decimal values?

Answer:

float.

Q34. What is a complex number in Python?

Answer:

A complex number contains a real part and an imaginary part, for example 3+4j.

Q35. What values can a Boolean variable store?

Answer:

True or False.

Q36. What is a string?

Answer:

A string is a sequence of characters enclosed in quotes.

Q37. What is a list?

Answer:

A list is an ordered and mutable collection of elements.

Q38. What is a tuple?

Answer:

A tuple is an ordered and immutable collection of elements.

Q39. What is a dictionary?

Answer:

A dictionary is a mutable collection of key-value pairs.

Q40. Differentiate between mutable and immutable data types.

Mutable Immutable
Can be modified after creation. Cannot be modified after creation.
Example: list, dictionary Example: string, tuple

Section 5: Operators and Expressions

Questions 41–50

Q41. What is an operator?

Answer:

An operator is a symbol or keyword used to perform an operation on one or more operands.

Q42. Name the arithmetic operators in Python.

Answer:

+, -, *, /, //, % and **.

Q43. What is the difference between / and //?

Answer:

/ performs true division, while // performs floor division.

Q44. What does the modulus operator % return?

Answer:

It returns the remainder after division.

Q45. What is the purpose of relational operators?

Answer:

They compare two values and return a Boolean result.

Q46. Name the logical operators in Python.

Answer:

and, or and not.

Q47. What are augmented assignment operators?

Answer:

They combine an operation with assignment, such as +=, -=, *= and /=.

Q48. What are identity operators?

Answer:

is and is not are identity operators used to check object identity.

Q49. What are membership operators?

Answer:

in and not in are membership operators used to test whether a value belongs to a sequence or collection.

Q50. What is operator precedence?

Answer:

Operator precedence determines the order in which operators are evaluated in an expression.

Section 6: Expressions, Input, Output and Type Conversion

Questions 51–60

Q51. What is an expression?

Answer:

An expression is a combination of values, variables, operators and function calls that produces a result.

Q52. What is a statement?

Answer:

A statement is an instruction that Python can execute.

Q53. Which function is used to accept input from the user?

Answer:

The input() function.

Q54. What type of value does input() return by default?

Answer:

It returns a string.

Q55. Which function is used to display output?

Answer:

The print() function.

Q56. What is type conversion?

Answer:

Type conversion is the process of converting a value from one data type to another.

Q57. What is explicit type conversion?

Answer:

Explicit conversion is performed by the programmer using functions such as int(), float() and str().

Q58. What is implicit type conversion?

Answer:

Implicit conversion is automatically performed by Python when required for compatible operations.

Q59. What is the output of the following?

x = 10
y = 3
print(x + y)
Answer:
13

Q60. What is the output of:

print(10 // 3)
print(10 % 3)
Answer:
3
1

Section 7: Errors and Flow of Control

Questions 61–70

Q61. What is a syntax error?

Answer:

A syntax error occurs when the rules or grammar of Python are violated.

Q62. What is a logical error?

Answer:

A logical error occurs when a program runs successfully but produces an incorrect result.

Q63. What is a runtime error?

Answer:

A runtime error occurs while a program is executing, such as division by zero.

Q64. Differentiate between syntax and logical errors.

Syntax Error Logical Error
Violates Python syntax. Program logic is incorrect.
Usually prevents execution. Program may execute but gives wrong output.

Q65. What is flow of control?

Answer:

Flow of control refers to the order in which statements of a program are executed.

Q66. What is sequential flow?

Answer:

In sequential flow, statements are executed one after another in their written order.

Q67. What is a conditional statement?

Answer:

A conditional statement executes different blocks of code depending on whether a condition is true or false.

Q68. Name the conditional statements in Python.

Answer:

if, if-else and if-elif-else.

Q69. Why is indentation important in Python?

Answer:

Indentation defines blocks of code and is essential for Python's syntax and program structure.

Q70. Write a statement to display "Pass" if marks are at least 40.

Answer:
if marks >= 40:
    print("Pass")

Section 8: Loops and Control Statements

Questions 71–80

Q71. What is iteration?

Answer:

Iteration means repeatedly executing a block of statements.

Q72. Name the two major looping statements in Python.

Answer:

for loop and while loop.

Q73. When is a for loop generally used?

Answer:

It is generally used when iterating over a sequence or a known range of values.

Q74. When is a while loop used?

Answer:

It is used when a block should continue executing as long as a specified condition remains true.

Q75. What is the purpose of the range() function?

Answer:

It generates a sequence of numbers commonly used with for loops.

Q76. What does the break statement do?

Answer:

It immediately terminates the nearest enclosing loop.

Q77. What does the continue statement do?

Answer:

It skips the remaining statements of the current iteration and moves to the next iteration.

Q78. What is a nested loop?

Answer:

A nested loop is a loop placed inside another loop.

Q79. What is the output?

for i in range(1, 4):
    print(i)
Answer:
1
2
3

Q80. What is the output?

for i in range(2, 8, 2):
    print(i)
Answer:
2
4
6

Section 9: Strings

Questions 81–88

Q81. What is a string in Python?

Answer:

A string is an ordered sequence of characters enclosed within quotes.

Q82. What is string indexing?

Answer:

Indexing is the process of accessing individual characters of a string using their positions.

Q83. From which index does Python begin indexing a string?

Answer:

Indexing starts from 0.

Q84. What is string slicing?

Answer:

Slicing is used to extract a portion of a string using a range of indices.

Q85. What is the output?

s = "Python"
print(s[0])
print(s[-1])
Answer:
P
n

Q86. What is the output?

s = "Computer"
print(s[0:4])
Answer:
Comp

Q87. What is string concatenation?

Answer:

Concatenation means joining two or more strings using the + operator.

Q88. What is string repetition?

Answer:

String repetition means repeating a string multiple times using the * operator.

Section 10: Lists, Tuples, Dictionaries and Modules

Questions 89–100

Q89. What is a list?

Answer:

A list is an ordered and mutable collection of elements, written using square brackets.

Q90. What is list slicing?

Answer:

List slicing extracts a portion of a list using a range of indices.

Q91. What is the difference between append() and extend()?

append() extend()
Adds one element to the end. Adds elements of another iterable.
list.append([3,4]) list.extend([3,4])

Q92. What is a tuple?

Answer:

A tuple is an ordered and immutable collection of elements, generally written using parentheses.

Q93. Why is a tuple called immutable?

Answer:

Because its elements cannot be changed after the tuple has been created.

Q94. What is tuple assignment?

Answer:

Tuple assignment allows multiple variables to receive multiple values in a single statement.

a, b, c = 10, 20, 30

Q95. What is a dictionary key?

Answer:

A key is a unique identifier used to access a corresponding value in a dictionary.

Q96. How are dictionary values accessed?

Answer:
student["name"]

A value can be accessed using its corresponding key.

Q97. What is the difference between a list and a dictionary?

List Dictionary
Elements are accessed using indices. Values are accessed using keys.
Written using [ ]. Written using { }.

Q98. What is a Python module?

Answer:

A module is a Python file containing reusable functions, variables or classes.

Q99. How can the math module be imported?

Answer:
import math

Q100. What is the output of the following program?

import math

print(math.sqrt(25))
print(math.pow(2, 3))
Answer:
5.0
8.0

Quick Revision: Important Python Concepts

Concept Remember This
Algorithm Step-by-step procedure to solve a problem.
Decomposition Breaking a complex problem into smaller parts.
Python High-level, interpreted, general-purpose language.
Variable Name/reference used to store a value.
List Ordered and mutable collection.
Tuple Ordered and immutable collection.
Dictionary Collection of key-value pairs.
String Sequence of characters.
input() Accepts input from the user and returns string by default.
print() Displays output.
if Used for decision making.
for Used for iteration over a sequence/range.
while Repeats while a condition is true.
break Terminates the loop.
continue Skips the current iteration.
math module Provides mathematical functions.
Exam Tip:

Do not learn Python only by memorising definitions. Practise output-based questions, trace loops line by line, understand indexing and slicing, and write small programs using conditions, loops and collections.

Final Revision Checklist

  • Understand problem-solving steps.
  • Practise algorithms, flowcharts and pseudocode.
  • Know Python tokens and identifier rules.
  • Understand variables, L-values and R-values.
  • Revise all Python data types.
  • Practise operator precedence.
  • Practise type conversion and input/output.
  • Identify syntax, logical and runtime errors.
  • Practise if, if-else and if-elif-else.
  • Practise for and while loops.
  • Understand break, continue and nested loops.
  • Practise string indexing, slicing and methods.
  • Practise list operations and methods.
  • Revise tuple operations and tuple assignment.
  • Understand dictionary keys and values.
  • Practise importing and using Python modules.