Class 12 Computer Science (FBISE) - Complete Notes
MCQs with Answers
1. Which of the following is equal to operator?
b. ==
2. The number of bytes reserved for a variable of data type 'float' is
b. 4
3. Which operator is used for compound condition?
d. Logical
4. Which of the following is an arithmetic operator?
b. %
5. Which one of the following is ignored during program execution?
b. Comment
6. What is the range of unsigned short integer?
c. 0 to 65535
7. In C++ the expression sum = sum + n can also be written as
a. sum += n
8. How cursor is moved to the next tabular position for printing data?
b. By using manipulator
9. Which sign is used for logical AND?
d. &&
10. Which one is called modulus operator?
b. %
Short Questions with Answers
Q1. What is the purpose of using header files in a program?
Answer:
Header files contain prewritten code like function declarations, making it easier to use features like
input/output.
Example: #include<iostream> allows using cin and cout.
Q2. Why escape sequences are used? Give three examples with explanation.
Answer:
Escape sequences control the formatting of output.
Examples:
- \n -> Move to new line
- \t -> Insert tab space
- \\ -> Print backslash
Q3. Define variable and write the rules for specifying variable names.
Answer:
A variable is a named location in memory used to store data.
Rules:
- Must start with a letter or underscore.
- Cannot have spaces or special characters.
- Cannot use reserved keywords.
Q4. Differentiate between Relational and Logical operators.
Answer:
- Relational Operators: Compare two values (e.g., <, >, ==).
- Logical Operators: Combine multiple conditions (e.g., &&, ||, !).
Q5. Explain the use of Assignment and Arithmetic operators.
Answer:
- Assignment Operator (=): Assigns a value to a variable.
- Arithmetic Operators (+, -, *, /, %): Perform mathematical operations.
Q6. Define reserved words with three examples.
Answer:
Reserved words are special keywords in C++ that have a fixed meaning and cannot be used as variable
names.
Examples: int, while, return
Q7. What is the function of endl and setw in C++?
Answer:
- endl: Moves the cursor to the next line.
- setw(n): Sets the width of the output to n characters.
Q8. Define RAM and ROM.
Answer:
- RAM (Random Access Memory): Temporary, volatile memory that loses data when power is off.
- ROM (Read Only Memory): Permanent, non-volatile memory.
Q9. Explain the working of Hard disk drive.
Answer:
A hard disk stores data magnetically on spinning platters. A read/write head moves to access data.
Q10. Explain Secondary storage devices.
Answer:
Devices that store data permanently and externally, like Hard Disks, SSDs, and USB drives.
Q11. Define CU and ALU.
Answer:
- CU (Control Unit): Manages the execution of instructions.
- ALU (Arithmetic Logic Unit): Performs arithmetic and logical operations.
Q12. What is a register? Write down different types of registers.
Answer:
Registers are small, fast memory locations inside the CPU.
Types:
- Accumulator
- Program Counter (PC)
- Instruction Register (IR)
Q13. Define Bit, Byte, and Nibble.
Answer:
- Bit: Smallest unit of data (0 or 1).
- Nibble: 4 bits.
- Byte: 8 bits.
Q14. Explain sequential access and direct access.
Answer:
- Sequential Access: Data is accessed in sequence (e.g., tape drives).
- Direct Access: Data can be accessed directly (e.g., hard disks).
Q15. Define bus. Explain the types of buses.
Answer:
A bus is a communication pathway that transfers data inside a computer.
Types:
- Data Bus
- Address Bus
- Control Bus
Q16. Define ports. Explain the functions of different ports used in computer.
Answer:
Ports are physical interfaces to connect external devices.
Examples:
- USB Port -> Connects pen drives, etc.
- HDMI Port -> Connects display devices.
- Serial Port -> Connects old devices like mouse.
Q17. Explain the working of optical disks (CD, DVD, Blu-ray).
Answer:
Optical disks use laser technology to read and write data on the disk surface.
Q18. Explain FOR LOOP with a program.
Answer:
A loop that runs a specific number of times.
Example:
for(int i = 0; i < 5; i++) {
cout << i;
Q19. Differentiate between While and Do-While loop.
Answer:
- While loop: Checks condition before executing.
- Do-While loop: Executes once before checking condition.
Q20. Explain Nested loop with a suitable example.
Answer:
A loop inside another loop.
Example:
for(int i = 1; i <= 2; i++) {
for(int j = 1; j <= 3; j++) {
cout << j;
Q21. What is switch statement? Explain it.
Answer:
Switch statement selects one of many blocks of code based on a variable value.
Example:
switch(x) {
case 1: cout << "One"; break;
Q22. Define operating system.
Answer:
An operating system manages computer hardware, software, and resources.
Q23. Define graphical user interface (GUI).
Answer:
GUI allows users to interact with a system using graphical elements like icons and windows.
Q24. Differentiate between multiprogramming and time-sharing operating system.
Answer:
- Multiprogramming: Runs multiple programs simultaneously.
- Time-sharing: Allows multiple users to use CPU time slices.
Q25. Differentiate between single-user and multiuser operating system.
Answer:
- Single-user OS: Only one user at a time (e.g., DOS).
- Multiuser OS: Multiple users simultaneously (e.g., UNIX).
Long Questions with Answers
Q1. Write a program that reads temperature in Fahrenheit and prints its equivalent in Celsius.
#include<iostream>
using namespace std;
int main() {
float f, c;
cout << "Enter Fahrenheit: ";
cin >> f;
c = 5.0/9 * (f - 32);
cout << "Celsius = " << c;
return 0;
}
Q2. Write a program that reads length and breadth of a rectangle and prints its area.
#include<iostream>
using namespace std;
int main() {
float length, breadth, area;
cout << "Enter length and breadth: ";
cin >> length >> breadth;
area = length * breadth;
cout << "Area = " << area;
return 0;
Q3. Write a program that reads four integers and prints their sum, product, and average.
#include<iostream>
using namespace std;
int main() {
int a, b, c, d;
cout << "Enter four integers: ";
cin >> a >> b >> c >> d;
cout << "Sum = " << (a+b+c+d) << endl;
cout << "Product = " << (a*b*c*d) << endl;
cout << "Average = " << (a+b+c+d)/4.0;
return 0;
Q4. Write a program that reads the base and height of a triangle and prints its area.
#include<iostream>
using namespace std;
int main() {
float base, height, area;
cout << "Enter base and height: ";
cin >> base >> height;
area = 0.5 * base * height;
cout << "Area = " << area;
return 0;
Q5. Explain the types of network: LAN, WAN, MAN, PAN.
Answer:
- LAN (Local Area Network): Connects computers in a small area (e.g., school).
- WAN (Wide Area Network): Covers large areas (e.g., internet).
- MAN (Metropolitan Area Network): Connects across a city.
- PAN (Personal Area Network): Connects personal devices like smartphones.
Q6. Explain the network topologies in detail.
Answer:
- Star Topology: All devices connect to a central hub.
- Ring Topology: Devices are connected in a circular path.
- Bus Topology: All devices share a single cable.
- Mesh Topology: Every device is connected to every other device.
Q7. Explain the 7 layers of OSI model.
Answer:
1. Physical Layer: Deals with transmission media (cables).
2. Data Link Layer: Error detection and MAC addressing.
3. Network Layer: Routing and IP addressing.
4. Transport Layer: Ensures complete data transfer (TCP/UDP).
5. Session Layer: Controls connections/sessions.
6. Presentation Layer: Data formatting and encryption.
7. Application Layer: Provides network services to applications (email, web).
Done!