CLASS – XII ISC 2023-24
1. Question: Define Propositional Logic.
Answer: Propositional Logic is a branch of
mathematical logic that deals with propositions or statements that are either
true or false. It uses logical operators to combine and manipulate these
propositions.
2. Question: What are the basic logical operators
in Propositional Logic?
Answer: The basic logical operators in
Propositional Logic are AND (∧), OR (∨), NOT (¬), IMPLICATION (→), and BICONDITIONAL (↔).
3. Question: State De Morgan's Laws and provide
an example.
Answer: De Morgan's Laws are:
The negation of a conjunction is the
disjunction of the negations: ¬(A ∧ B) = ¬A ∨ ¬B.
The negation of a disjunction is the
conjunction of the negations: ¬(A ∨ B) = ¬A ∧ ¬B.
Example: ¬(P ∧ Q) = ¬P ∨ ¬Q and ¬(P ∨ Q) = ¬P ∧ ¬Q.
4. Question: Explain what a tautology is in
Propositional Logic.
Answer: A tautology is a compound proposition
that is always true, regardless of the truth values of its constituent
propositions. For example, (P ∨ ¬P) is a tautology because it is true for all possible truth
values of P.
5. Question: Differentiate between exclusive OR
(XOR) and inclusive OR (OR) operations.
Answer: XOR is true when exactly one of the
operands is true, while OR is true when at least one of the operands is true.
XOR is true when both operands are different (one is true, and the other is
false), whereas OR is true when either or both operands are true.
6. Question: What is a truth table, and how is
it used in Propositional Logic?
Answer: A truth table is a tabular
representation of all possible combinations of truth values for a compound
proposition. It shows the truth values of the proposition for each combination
of truth values of its constituent propositions, helping to determine the
overall truth value of the compound proposition.
7. Question: Define Boolean Algebra.
Answer: Boolean Algebra is a mathematical
system that deals with binary variables and operations (0 and 1) using logical
operators (AND, OR, NOT, etc.). It is widely used in digital electronics and
computer science for logic design and simplification.
8. Question: Explain the concept of Boolean
Identity Laws.
Answer: Boolean Identity Laws are a set of
fundamental laws in Boolean Algebra. They include the identity law (A + 0 = A
and A * 1 = A), domination law (A + 1 = 1 and A * 0 = 0), and the complement law
(A + A' = 1 and A * A' = 0).
9. Question: How can Boolean Algebra be applied
in circuit design?
Answer: Boolean Algebra can be used to simplify
and analyze logical circuits. By representing logical expressions and truth
tables, designers can optimize circuits, reduce the number of gates, and
minimize complexity in digital systems.
10. Question: Give an example of using Boolean
Algebra to simplify a logical expression.
Answer: Consider the expression F = A'B + AB.
Using Boolean Algebra, we can simplify it to F = B, demonstrating the
simplification capabilities of Boolean Algebra.
1. Question: Define computer hardware.
Answer: Computer hardware refers to the
physical components of a computer system, such as the central processing unit
(CPU), memory, storage devices, input/output devices, and motherboard.
2. Question: What is the function of the CPU in
a computer system?
Answer: The CPU (Central Processing Unit) is
the "brain" of the computer. It performs arithmetic and logical
operations, executes instructions, and controls the overall operation of the
computer.
3. Question: Differentiate between RAM and ROM.
Answer: RAM (Random Access Memory) is volatile
memory used for temporarily storing data and program instructions, while ROM
(Read-Only Memory) is non-volatile memory that contains firmware or software
instructions that are permanently stored.
4. Question: Explain the role of the
motherboard in a computer system.
Answer: The motherboard is the main circuit
board that connects and holds various hardware components. It facilitates
communication between the CPU, memory, storage, and input/output devices.
5. Question: What is the purpose of an
operating system in a computer?
Answer: An operating system manages hardware
resources, provides a user interface, and facilitates the execution of software
programs. It acts as an intermediary between users and hardware.
6. Question: Describe the differences between
HDD and SSD storage technologies.
Answer: HDD (Hard Disk Drive) uses spinning
disks to store data and has moving parts, while SSD (Solid State Drive) uses
flash memory for data storage and has no moving parts. SSDs are faster and more
durable but typically cost more per gigabyte.
7. Question: What is the role of a GPU in a
computer, and when is it particularly important?
Answer: A GPU (Graphics Processing Unit) is
responsible for rendering graphics and images. It is crucial for tasks like
gaming, video editing, and 3D rendering, which require high-quality graphics
performance.
8. Question: Explain the concept of input and
output devices in the context of computer hardware.
Answer: Input devices allow users to enter data
into a computer, e.g., keyboard, mouse, or microphone. Output devices present
information to the user, e.g., monitor, printer, or speakers.
9. Question: What are expansion slots on a
motherboard, and how are they used?
Answer: Expansion slots are connectors on the
motherboard for adding additional hardware components, such as graphics cards,
sound cards, or network cards, to enhance a computer's capabilities.
10. Question: What is the importance of power
supplies in a computer system?
Answer: Power supplies provide electrical power
to all computer components. They convert the alternating current (AC) from the
wall outlet into the direct current (DC) needed by the computer, ensuring
stable and regulated power distribution.
1. Question: What is Java?
Answer: Java is a high-level, object-oriented
programming language known for its platform independence, meaning Java programs
can run on any system with a compatible Java Virtual Machine (JVM).
2. Question: Explain the difference between
JDK, JRE, and JVM.
Answer: The Java Development Kit (JDK) contains
the tools necessary for Java development, including the Java Compiler. The Java
Runtime Environment (JRE) is used to run Java applications, and the Java
Virtual Machine (JVM) is an integral part of the JRE that executes Java
bytecode.
3. Question: What are the main features of
Java?
Answer: Key features of Java include platform
independence, object-oriented programming, robustness, security,
multi-threading, and automatic memory management (garbage collection).
4. Question: What is the purpose of a
constructor in Java?
Answer: Constructors are special methods used
to initialize objects. They have the same name as the class and are called when
an object is created. Constructors typically set the initial state of an
object.
5. Question: Differentiate between instance
variables and local variables in Java.
Answer: Instance variables are declared within
a class and belong to an object. Local variables are declared within a method
and have a limited scope within that method.
6. Question: Explain the concept of inheritance
in Java.
Answer: Inheritance is a fundamental
object-oriented programming concept in Java. It allows a new class to inherit
properties and behaviors from an existing class, promoting code reuse and a
hierarchical organization of classes.
7. Question: What is the purpose of the 'super'
keyword in Java?
Answer: The 'super' keyword is used to call a
superclass's constructor, access superclass methods or variables, and avoid
ambiguity when a subclass has methods or variables with the same name as the
superclass.
8. Question: What is an interface in Java?
Answer: An interface is a contract that defines
a set of abstract methods. Classes that implement an interface must provide
implementations for the defined methods. Java supports multiple interface
inheritance.
9. Question: What is exception handling in
Java, and why is it important?
Answer: Exception handling is a mechanism to
handle runtime errors gracefully. Java provides 'try,' 'catch,' 'finally,' and
'throw' statements to manage exceptions. Effective exception handling helps
ensure the reliability and stability of Java programs.
10. Question: What is the role of the 'main'
method in a Java program?
Answer: The 'main' method is the entry point
for a Java program. It is the method that is called when the program is
executed and serves as the starting point for program execution.
1. Question: What is the purpose of control
structures in programming?
Answer: Control structures determine the flow
of a program, enabling you to make decisions and execute statements
conditionally or repeatedly. They help control the order in which statements
are executed.
2. Question: Explain the difference between a
single-selection and a double-selection control structure.
Answer: A single-selection control structure,
such as the "if" statement, allows for the execution of a block of
code when a condition is true. A double-selection control structure, like the
"if-else" statement, offers two paths of execution: one when a
condition is true and another when it's false.
3. Question: What is a "for" loop,
and how does it work in programming?
Answer: A "for" loop is a control
structure used for iterative processes. It consists of an initialization
statement, a condition for continuation, and an update statement. The loop
iterates as long as the condition is true, executing the specified code block.
4. Question: Define the term "nested
control structure" in programming.
Answer: A nested control structure is when one
control structure (e.g., a loop or conditional statement) is placed inside
another. This allows for more complex decision-making and repetitive processes.
5. Question: How does a "switch"
statement differ from a series of "if-else" statements?
Answer: A "switch" statement is used
to select one of several code blocks to execute based on the value of an
expression. It is more efficient and often easier to read than a series of
"if-else" statements when there are multiple options to consider.
6. Question: What is the purpose of the
"break" statement in control structures?
Answer: The "break" statement is used
to exit a loop prematurely, typically when a specific condition is met. It is
also used in "switch" statements to terminate the execution of a case
block.
7. Question: Explain the concept of a
"while" loop.
Answer: A "while" loop is a control
structure that repeatedly executes a block of code as long as a specified
condition remains true. If the condition initially evaluates to false, the
block of code is never executed.
8. Question: What is the significance of the
"do-while" loop in programming?
Answer: The "do-while" loop is
similar to a "while" loop but guarantees that the block of code is
executed at least once, as the condition is checked after the code execution.
9. Question: Describe the use of
"goto" statements in control structures.
Answer: "Goto" statements are used to
transfer control to a labeled statement within a program. However, they are
discouraged in modern programming practices as they can make code less
structured and harder to read and maintain.
10. Question: How can control structures be
used to implement decision-making and repetition in programming?
Answer: Control structures like conditional
statements (if, if-else) and loops (for, while, do-while) allow for making
decisions based on conditions and repeating actions or blocks of code as
necessary, thus providing control and structure to a program's execution flow.
1. Question: What is a method in programming,
and why is it used?
Answer: A method is a self-contained block of
code that performs a specific task. It is used for code modularity,
reusability, and to simplify complex programs by breaking them into smaller,
manageable parts.
2. Question: Explain the concept of method
parameters.
Answer: Method parameters are variables that a
method can accept as inputs. They allow data to be passed into the method for
processing. Parameters are defined in the method signature and used within the
method's block.
3. Question: What is the return type of a
method, and why is it important?
Answer: The return type specifies the data type
of the value that a method returns after its execution. It's important because
it indicates the type of data that the calling code can expect to receive from
the method.
4. Question: How do you call a method in Java?
Answer: To call a method, you use its name
followed by parentheses. If the method requires arguments, you pass them within
the parentheses. For example, methodName(argument1, argument2);.
5. Question: Explain the concept of recursion
in programming.
Answer: Recursion is a technique in which a
method calls itself to solve a problem. It's particularly useful for solving
problems that can be broken down into smaller, similar sub-problems.
6. Question: What is a base case in a recursive
function?
Answer: The base case is the condition in a
recursive function that specifies when the recursion should stop. It prevents
infinite recursion and provides a termination point.
7. Question: Describe the key differences
between iterative and recursive solutions to problems.
Answer: Iterative solutions use loops to repeat
a set of statements, while recursive solutions use method calls to solve
problems by breaking them into smaller, similar sub-problems. Recursion is
often more elegant for certain types of problems but can be less efficient in
terms of memory usage.
8. Question: What is the stack in the context
of recursive method calls?
Answer: The stack is a data structure that
keeps track of method calls in a recursive program. Each method call is pushed onto
the stack, and when a method returns, it is popped from the stack.
9. Question: What are the advantages of using
recursion in programming?
Answer: Recursion can make code more elegant,
solve problems naturally suited to a divide-and-conquer approach, and lead to
more readable solutions in some cases. It is particularly useful for problems
with inherent hierarchical structures.
10. Question: Can all iterative solutions be
implemented using recursion? Why or why not?
Answer: Not all iterative solutions can be
implemented using recursion. Some problems are better suited to iterative
solutions, and trying to solve them using recursion may lead to stack overflow
errors or inefficient code.
1. Question: What is an array in computer
programming?
Answer: An array is a data structure that
stores a collection of elements of the same data type, accessible by their
index or position in the array.
2. Question: How do you declare and initialize
an array in Java?
Answer: In Java, you declare an array using the
syntax: dataType[] arrayName = new dataType[arraySize]; or with an initializer
list: dataType[] arrayName = {value1, value2, ...};
3. Question: What is the difference between a
one-dimensional array and a two-dimensional array?
Answer: A one-dimensional array stores elements
in a single sequence. In contrast, a two-dimensional array is a matrix-like
structure with rows and columns, allowing for the storage of data in a grid.
4. Question: Explain the concept of an
"index" in the context of arrays.
Answer: An index is a numeric value used to
access individual elements in an array. It represents the position of an
element within the array, starting from zero for the first element.
5. Question: How do you find the length or size
of an array in Java?
Answer: In Java, you can use the length
attribute to find the length or size of an array. For example, int[] myArray =
{1, 2, 3}; int arrayLength = myArray.length; will set arrayLength to 3.
6. Question: What are strings in programming,
and how are they different from character arrays?
Answer: Strings are sequences of characters,
and they are a higher-level data type in programming. Character arrays are
low-level arrays of characters. Strings in languages like Java are objects,
offering various string manipulation methods.
7. Question: Explain the concept of string
concatenation.
Answer: String concatenation is the process of
combining two or more strings to create a single, longer string. In Java, you
can use the + operator or the concat() method to concatenate strings.
8. Question: What is the difference between a
null string and an empty string?
Answer: A null string is a string that doesn't
reference any object and is typically represented as null. An empty string is a
valid string with a length of 0, containing no characters and is represented as
an empty set of double quotes, "".
9. Question: How can you compare two strings
for equality in Java?
Answer: In Java, you should use the equals()
method to compare the contents of two strings for equality. For reference
equality, you can use the == operator.
10. Question: What is the role of the charAt()
method in string manipulation?
Answer: The charAt() method is used to retrieve
the character at a specified index within a string. It allows you to access
individual characters in a string.
1. Question: What is the main method in a Java
program, and why is it necessary?
Answer: The main method in a Java program is
the entry point for program execution. It is required for the Java Virtual
Machine (JVM) to start the program. The main method is defined as public static
void main(String[] args).
2. Question: Explain the steps involved in the
execution of a Java program.
Answer: The steps in the execution of a Java
program include compilation, loading of classes by the JVM, linking, and
execution. The JVM loads the classes, links them to the runtime environment,
and executes the main method.
3. Question: What is the purpose of the
classpath in Java?
Answer: The classpath is an environment
variable that specifies the location of classes and libraries used by a Java
program. It tells the JVM where to find the necessary classes and resources.
4. Question: What are exceptions in Java, and
why are they important?
Answer: Exceptions are runtime errors or
unusual conditions that disrupt the normal flow of a program. They are
important because they allow for the detection and handling of errors,
preventing a program from crashing.
5. Question: How is exception handling
implemented in Java?
Answer: Exception handling in Java is done
using the try, catch, finally, and throw blocks. Code that may throw an
exception is placed within a try block, and potential exceptions are caught and
handled in a catch block. The finally block ensures that certain code is
executed, whether an exception occurs or not.
6. Question: What is the difference between a
checked exception and an unchecked exception in Java?
Answer: Checked exceptions (e.g., IOException)
must be either caught using try-catch or declared in the method's signature.
Unchecked exceptions (e.g., NullPointerException) do not require this and are
typically caused by programming errors.
7. Question: How is exception propagation in
Java handled?
Answer: Exception propagation occurs when an
exception is thrown in a method but not caught. It continues to propagate up
the call stack until it is caught or the program terminates. This can be
managed by declaring exceptions in method signatures or using try-catch blocks.
8. Question: What is the purpose of the throws
keyword in Java?
Answer: The throws keyword is used in a method
signature to indicate that the method may throw exceptions and that they should
be handled by the calling code or caught by the method itself.
9. Question: Explain the use of the throw
statement in Java.
Answer: The throw statement is used to
explicitly throw an exception in a program. It is often used in custom
exception handling when a specific error condition is encountered.
10. Question: What is the significance of the
try-with-resources statement in Java for exception handling?
Answer: The try-with-resources statement is
used to automatically close resources (e.g., files, sockets) at the end of a
block, ensuring resource cleanup and proper exception handling, without the
need for explicit finally blocks.
1. Question: What is file handling in computer
science?
Answer: File handling is the process of
creating, reading, writing, and managing files on a computer's storage media.
It allows programs to interact with files for data storage and retrieval.
2. Question: How can you open an existing file
for reading in Java?
Answer: In Java, you can open an existing file
for reading using classes like FileInputStream and FileReader, along with
appropriate error handling.
3. Question: Explain the difference between
text files and binary files.
Answer: Text files store data in a
human-readable format, while binary files store data in a format that isn't
easily human-readable. Binary files are used for various data types and
non-textual content.
4. Question: What are the common operations
performed on files in file handling?
Answer: Common file operations include opening,
reading, writing, closing, creating, deleting, moving, and searching for files.
Additionally, file handling includes operations like checking file existence
and permissions.
5. Question: What is a file stream, and why is
it important in file handling?
Answer: A file stream is a connection between a
program and a file. It allows data to flow between the program and the file.
File streams are crucial for reading from or writing to files in a structured
manner.
6. Question: How can you write data to a text
file in Java?
Answer: In Java, you can write data to a text
file using classes like FileOutputStream and FileWriter. You can also use
buffering for efficient writing.
7. Question: Explain the purpose of exception
handling in file operations.
Answer: Exception handling is essential in file
handling to gracefully handle potential errors, such as file not found,
permissions issues, or I/O errors. It ensures that a program can recover or
report errors without crashing.
8. Question: What is the "file
pointer," and how is it used in file handling?
Answer: The file pointer is a marker that keeps
track of the current position in a file. It determines where the next read or
write operation will occur. The file pointer is crucial for sequential file
access.
9. Question: What is random access in the
context of file handling?
Answer: Random access allows you to read or
write data at any position within a file, rather than just sequentially. It is
useful for quickly retrieving or updating specific pieces of data in a file.
10. Question: How can you close a file properly
in file handling, and why is it important?
Answer: In file handling, closing a file is
done using the close() method or equivalent. It is important because it
releases system resources and ensures that data is saved and the file is
available for other processes or programs.
1. Question: What is inheritance in
object-oriented programming, and why is it important?
Answer: Inheritance is a mechanism in which a
new class inherits properties and behaviors (fields and methods) from an
existing class. It promotes code reuse and establishes a hierarchy of classes.
It's important for building more organized and maintainable code.
2. Question: Explain the concept of a
superclass and a subclass in inheritance.
Answer: A superclass (or base class) is the
existing class from which another class (the subclass or derived class)
inherits properties and behaviors. The subclass can extend or modify the
inherited elements.
3. Question: What is the keyword 'extends' used
for in Java inheritance?
Answer: In Java, the 'extends' keyword is used
to create a subclass that inherits from a superclass. It establishes an
"is-a" relationship between the two classes.
4. Question: How does method overriding work in
the context of inheritance?
Answer: Method overriding is the process of
providing a new implementation for a method in a subclass. It allows a subclass
to customize the behavior of a method that it inherits from the superclass.
5. Question: What is an interface in Java, and
how does it differ from a class?
Answer: An interface in Java is a blueprint for
a class, defining a set of methods that must be implemented by any class that
implements the interface. It differs from a class in that it contains method
signatures but cannot have instance variables or method implementations.
6. Question: Explain the concept of
polymorphism in object-oriented programming.
Answer: Polymorphism is the ability of objects
of different classes to respond to the same method in a way that is appropriate
for their specific class. It promotes flexibility and dynamic method
invocation.
7. Question: How does method overloading relate
to polymorphism?
Answer: Method overloading is a form of
polymorphism where multiple methods have the same name but different parameter
lists within a class. The appropriate method to call is determined at compile
time based on the method signature.
8. Question: What is the 'super' keyword used
for in Java, and when is it necessary?
Answer: The 'super' keyword is used to call a
method or constructor from the superclass when there is a method or constructor
in the subclass with the same name. It is necessary to resolve ambiguity in
such cases.
9. Question: Can a class implement multiple
interfaces in Java, and why is it useful?
Answer: Yes, a class in Java can implement
multiple interfaces. This is known as multiple inheritance through interfaces.
It is useful for allowing a class to inherit behavior and obligations from
multiple sources, promoting code flexibility and reuse.
10. Question: What is dynamic polymorphism, and
how does it relate to method overriding?
Answer: Dynamic polymorphism, also known as
runtime polymorphism, is the ability of an object to decide at runtime which
method to invoke based on its actual type. Method overriding is the primary
mechanism for achieving dynamic polymorphism in Java.
1. Question: What is a data structure in
computer science?
Answer: A data structure is a way of organizing
and storing data to perform operations efficiently, such as insertion,
deletion, and searching.
2. Question: Explain the difference between an
array and a linked list.
Answer: An array is a linear data structure
that stores elements of the same data type with a fixed size, while a linked
list is a linear data structure that dynamically allocates memory for elements
and connects them through pointers.
3. Question: What is the advantage of using a
stack data structure?
Answer: A stack is a data structure that
follows the Last-In-First-Out (LIFO) principle. It is often used for tasks such
as tracking function calls, implementing undo operations, and managing
expressions and algorithms.
4. Question: Define a binary tree.
Answer: A binary tree is a hierarchical data
structure consisting of nodes, where each node has at most two child nodes: a
left child and a right child. It is used in various applications, including
search trees and expression evaluation.
5. Question: What is the purpose of a hash
table in data structures?
Answer: A hash table is a data structure used
to store and retrieve data efficiently using a key-value pair association. It
uses a hash function to map keys to specific locations, providing fast access.
6. Question: Explain the concept of a queue
data structure.
Answer: A queue is a data structure that
follows the First-In-First-Out (FIFO) principle. It is used for tasks such as
managing tasks in a print queue, scheduling processes, and implementing
breadth-first search algorithms.
7. Question: What is the difference between a
stack and a queue?
Answer: A stack follows the Last-In-First-Out
(LIFO) principle, while a queue follows the First-In-First-Out (FIFO)
principle. Stacks are used for task reversal, and queues are used for tasks in
the order they are received.
8. Question: How do you perform a binary search
on a sorted array?
Answer: Binary search is a divide-and-conquer
algorithm that works by repeatedly dividing the array in half and comparing the
target value with the middle element to determine whether it is in the left or
right half.
9. Question: What is the role of a linked list
in data structures, and when is it preferred over an array?
Answer: A linked list is a dynamic data
structure used when elements need to be inserted or removed frequently, as it
can efficiently adjust its size. It is preferred over an array when the number
of elements is not known in advance, and memory is allocated as needed.
10. Question: Explain the concept of a
doubly-linked list.
Answer: A doubly-linked list is a variation of
a linked list where each node contains references to both the next and previous
nodes. This structure allows for efficient traversal in both directions, but it
requires more memory compared to a singly-linked list.