CLASS – XII CBSE 2023-24
Code 083
1. What is computational thinking?
Computational thinking is a problem-solving
approach that involves breaking down complex problems into smaller, manageable
parts that can be solved using computers.
2. Define an algorithm.
An algorithm is a step-by-step procedure or a
set of instructions for solving a specific problem.
3. What is a flowchart, and how is it used in
programming?
A flowchart is a visual representation of an
algorithm or a program's logic. It uses various symbols and shapes to represent
processes, decisions, and data.
4. Explain the concept of abstraction in
computational thinking.
Abstraction is the process of simplifying a
complex problem by focusing on the most relevant details while ignoring
irrelevant information.
5. What is the significance of pseudocode in
programming?
Pseudocode is a way to express an algorithm in
a high-level, human-readable format before translating it into code. It helps
in planning and clarifying the logic of a program.
6. Differentiate between high-level programming
languages and low-level programming languages.
High-level programming languages are more
user-friendly and abstract, while low-level languages are closer to the machine
and hardware and are less human-readable.
7. What is a variable in Python?
A variable is a named container used to store
data values in Python.
8. Explain the difference between local and
global variables in Python.
Local variables are defined within a specific
function and are only accessible within that function, while global variables
are defined at the module level and can be accessed from any part of the
program.
9. Describe the purpose of the 'if' statement
in Python.
The 'if' statement is used for conditional
execution. It allows you to execute a block of code if a specified condition is
true.
10. What is a loop in programming?
- A loop is a control structure that repeats a
group of statements until a specific condition is met.
11. Differentiate between 'for' and 'while'
loops in Python.
- 'For' loops are used for iterating over a
sequence (e.g., a list), while 'while' loops execute as long as a specified
condition is true.
12. Explain the purpose of a function in
Python.
- A function is a block of code that performs a
specific task. It allows you to encapsulate code for reusability and
modularity.
13. What is recursion, and how does it work in
Python?
- Recursion is a technique where a function
calls itself. It's often used to solve problems that can be broken down into
smaller, similar subproblems.
14. How are lists represented in Python?
- Lists in Python are represented as ordered
collections of items enclosed in square brackets, and each item is separated by
a comma.
15. Describe the concept of a dictionary in
Python.
- A dictionary is an unordered collection of
key-value pairs, where each key is unique.
16. What are libraries or modules in Python,
and why are they used?
- Libraries or modules are pre-written code
libraries that provide additional functionality. They are used to avoid
reinventing the wheel and improve code reusability.
17. How is exception handling used in Python,
and why is it important?
- Exception handling allows you to handle
errors or exceptional situations gracefully, preventing program crashes. It's
essential for robust program design.
18. Explain the purpose of object-oriented
programming (OOP) in Python.
- OOP is a programming paradigm that uses
objects and classes to organize and structure code, making it more modular and
maintainable.
19. What is the role of constructors in Python
classes?
- Constructors are special methods used to
initialize class objects. They are executed when an object of a class is
created.
20. Describe inheritance in Python classes.
- Inheritance allows a new class to inherit the
properties and methods of an existing class, promoting code reuse and building
hierarchies of classes.
21. What is polymorphism in object-oriented
programming?
- Polymorphism allows objects of different
classes to be treated as objects of a common base class. It enables flexibility
and extensibility in code.
22. Explain the concept of encapsulation in
Python classes.
- Encapsulation is the bundling of data and
methods that operate on that data into a single unit called a class. It
provides data hiding and access control.
23. What are modules in Python, and why are
they used?
- Modules are Python files containing
functions, classes, and variables. They are used to organize code and promote
reusability.
24. How do you import modules in Python?
- You can import modules using the import
statement. For example, import math imports the math module.
25. What is a GUI (Graphical User Interface),
and how can it be created in Python?
- A GUI allows users to interact with programs
through graphical elements. Python provides libraries like Tkinter for creating
GUI applications.
26. Describe file handling in Python.
- File handling in Python involves reading from
and writing to files. It is essential for data input and output operations.
27. What is an API, and how can it be used in
Python?
- An API (Application Programming Interface)
defines how software components should interact. Python can be used to access
and work with APIs to retrieve data or perform functions.
28. What is a database, and how can Python be
used for database access?
- A database is a structured collection of
data. Python provides libraries like SQLite or connectors for databases like
MySQL to access and manipulate data.
29. Explain the purpose of regular expressions
in Python.
- Regular expressions are used to search for
and manipulate text based on patterns. They provide powerful string
manipulation capabilities.
30. How does error handling differ from
exception handling in Python?
- Error handling refers to the process of
identifying and handling different types of errors, while exception handling
specifically deals with runtime errors or exceptional situations.
31. Describe the purpose of the 'try-except'
block in Python.
- The 'try-except' block is used to catch and
handle exceptions, preventing the program from crashing.
32. What is a tuple in Python, and how is it
different from a list?
- A tuple is an ordered collection of items
similar to a list but is immutable (cannot be changed after creation).
33. How can you use 'with' statements in Python
for file handling?
- 'With' statements simplify file handling by
ensuring that resources are properly managed and automatically closed after
use.
34. Explain the concept of data types in
Python.
- Data types define the type of data that can
be stored in a variable. Python includes types like int, float, str, and more.
35. What is type casting in Python, and why is
it useful?
- Type casting is the conversion of one data
type into another. It's useful when you need to change the type of a variable
or perform operations with mixed types.
36. How can you define and use a function in
Python?
- You can define a function in Python using the
def keyword followed by the function name and parameters. Here's an example:
```python
def greet(name):
return "Hello, " + name + "!"
result = greet("Prity")
print(result)
# Output: Hello, Prity!
```
37. What is the purpose of the 'return'
statement in a function?
- The 'return' statement is used to specify the
value that the function should return when it is called. It allows functions to
provide results or data to the caller.
38. How do you pass arguments to a function in
Python?
- Arguments can be passed to a function when it
is called. These arguments are specified within the parentheses when calling
the function.
```python
def add(a, b):
return a + b
result = add(5, 3) # 5 and 3 are the arguments
```
39. What is the purpose of comments in Python
code?
- Comments are used to provide explanations or
documentation within the code. They are not executed and are essential for code
readability and understanding.
40. Explain the role of the 'if name ==
"main":' statement in a Python script.
- This statement is used to determine whether a
Python script is being run as the main program or imported as a module. Code
within this block is executed only if the script is the main program.
```python
if __name__ == "__main__":
#
Code here is executed when the script is run as the main program.
```
1. What is a computer network?
A computer network is a collection of
interconnected computers and devices that can communicate and share resources
with each other.
2. What is the purpose of a network topology?
Network topology refers to the physical or
logical arrangement of network devices and connections. It helps determine how
data is transmitted in a network.
3. What is the OSI model, and how many layers
does it have?
The OSI (Open Systems Interconnection) model is
a conceptual framework that standardizes network communications. It has seven
layers: Physical, Data Link, Network, Transport, Session, Presentation, and
Application.
4. Explain the role of the Physical layer in
the OSI model.
The Physical layer deals with the transmission
of raw data bits over the physical medium, including hardware specifications
like cables and connectors.
5. What is the purpose of the Network layer in
the OSI model?
The Network layer is responsible for routing
data packets between different networks and handling logical addressing and
routing.
6. What are IP addresses, and why are they
important in networking?
IP addresses are unique numeric identifiers
assigned to devices on a network. They are essential for routing data to the
correct destination.
7. Define a subnet mask in the context of IP
addresses.
A subnet mask is used to divide an IP address
into network and host portions. It helps determine which part of the IP address
identifies the network and which part identifies the host.
8. What is the role of a router in a network?
A router is a network device that connects
different networks and directs data packets between them. It makes forwarding
decisions based on IP addresses.
9. What is a firewall, and how does it enhance
network security?
A firewall is a network security device that
filters incoming and outgoing network traffic, allowing or blocking data based
on predefined security rules. It helps protect a network from unauthorized
access.
10. Explain the purpose of DNS (Domain Name
System) in computer networks.
- DNS is a system that translates
human-readable domain names (e.g., www.example.com) into IP addresses. It
allows users to access websites and services using domain names instead of
numeric IP addresses.
1. What is a database in the context of MySQL?
A database in MySQL is a structured collection
of data that is organized, stored, and managed for efficient retrieval and
manipulation.
2. Explain the term "DBMS" and its
significance in database management.
DBMS stands for Database Management System. It
is software that enables the creation, maintenance, and use of databases. It
provides a systematic way to manage and access data.
3. What is SQL, and how is it used in MySQL?
SQL (Structured Query Language) is a
domain-specific language used to manage and manipulate relational databases. It
is the primary language for querying and managing data in MySQL.
4. What is a table in MySQL, and how is it
structured?
In MySQL, a table is a collection of related
data organized into rows and columns. Columns represent attributes, and rows represent
individual records.
5. Define a primary key in the context of
database tables.
A primary key is a unique identifier for a
record in a table. It ensures that each record is unique and can be used to
reference the record.
6. Explain the concept of a foreign key in
MySQL.
A foreign key is a field in a table that is
used to establish a link between two tables. It enforces referential integrity
between related tables.
7. What is normalization in the context of
database design?
Normalization is the process of organizing data
in a database to reduce redundancy and dependency. It involves breaking down
tables into smaller, related tables.
8. What is an index in MySQL, and why is it
important in database management?
An index is a data structure that improves the
speed of data retrieval operations on a database table. It's important for
efficient querying.
9. Explain the purpose of a stored procedure in
MySQL.
A stored procedure is a precompiled SQL code
that can be executed repeatedly. It can include a sequence of SQL statements
and is used for automation and reusability.
10. How is data integrity maintained in MySQL
databases?
- Data integrity in MySQL is maintained through
constraints, such as primary keys, foreign keys, and unique constraints, which ensure
the accuracy and consistency of data.
11. What is the role of the 'SELECT' statement
in MySQL?
- The 'SELECT' statement is used to retrieve
data from one or more tables in a MySQL database. It allows you to specify
which columns and rows to retrieve.
12. Explain the 'INSERT' statement in MySQL and
its usage.
- The 'INSERT' statement is used to add new
records (rows) to a table in MySQL. It allows you to specify the values to be
inserted into the table.
13. What is the purpose of the 'UPDATE' statement
in MySQL?
- The 'UPDATE' statement is used to modify
existing records in a table. It allows you to change the values of specific
columns based on a given condition.
14. Describe the 'DELETE' statement in MySQL
and how it is used.
- The 'DELETE' statement is used to remove
records from a table in MySQL. It allows you to specify a condition to identify
which records to delete.
15. What is a view in MySQL, and how does it
differ from a table?
- A view is a virtual table created by a query.
It is not a physical table but provides a way to present data from one or more
tables in a structured form without duplicating the data.
16. Explain the ACID properties in the context
of database transactions.
- ACID stands for Atomicity, Consistency,
Isolation, and Durability. These properties ensure that database transactions
are reliable, consistent, and error-resistant.
17. What is a trigger in MySQL, and how does it
work?
- A trigger is a predefined action that is
automatically executed when a specific event occurs in the database. Triggers
are often used to maintain data integrity and enforce rules.
18. Describe the purpose of the 'JOIN'
operation in MySQL.
- The 'JOIN' operation is used to combine data
from two or more tables based on a related column. It allows you to retrieve
data from multiple tables in a single query.
19. What is data modeling, and why is it
important in database design?
- Data modeling is the process of creating an
abstract representation of data and its relationships in a database. It helps
in designing databases that accurately represent the real-world data.
20. How does database normalization improve
data management in MySQL?
- Database normalization reduces data
redundancy and dependency, which leads to more efficient storage and data
retrieval. It helps maintain data consistency and accuracy.