Class 12 NEB Computer Science Q&A with Solutions
Complete Question & Answer Guide
A quick overview of important topics with revision-friendly points. Click any question to view guidance notes.
Note: This is a study overview, not an official answer key. Always cross-check with your textbook, teacher, and latest NEB pattern.
Database Management System
Database
A database is an organized collection of related data stored systematically so it can be easily accessed, managed, and updated.
DBMS
A Database Management System (DBMS) is software that allows users to create, store, manage, and retrieve data from a database. Examples: MySQL, Oracle, MS Access.
Advantages of DBMS over File System
- No Data Redundancy: Data is stored once; no duplication.
- Data Consistency: Changes in one place reflect everywhere.
- Data Sharing: Multiple users can access data simultaneously.
- Data Security: Access can be controlled through user permissions.
- Data Integrity: Rules enforce accuracy and validity of data.
- Easy Data Recovery: Backup and recovery mechanisms are built in.
- Data Independence: Changes in structure don't affect programs.
| Key | Definition | Example |
|---|---|---|
| Candidate Key | Any attribute(s) that can uniquely identify a record | StudentID, Email (both can identify a student) |
| Primary Key | The candidate key selected by the designer to uniquely identify each row | StudentID |
| Alternate Key | Candidate keys NOT chosen as primary key | Email (when StudentID is primary) |
| DDL (Data Definition Language) | DML (Data Manipulation Language) |
|---|---|
| Defines structure/schema of database | Manipulates (manages) the data inside |
| Deals with tables, columns, structure | Deals with rows and actual data |
| Changes are auto-committed | Changes can be rolled back |
CREATE, ALTER, DROP, TRUNCATE |
INSERT, UPDATE, DELETE, SELECT |
Examples
DDL: CREATE TABLE Student (ID INT, Name VARCHAR(50));
DML: INSERT INTO Student VALUES (1, 'Ram');
Normalization
Normalization is the process of organizing a database to reduce redundancy and improve data integrity by dividing large tables into smaller ones.
2NF (Second Normal Form)
- Must be in 1NF (no repeating groups).
- Every non-key attribute must depend on the whole primary key, not just part of it.
- Removes partial dependency.
3NF (Third Normal Form)
- Must be in 2NF.
- No non-key attribute should depend on another non-key attribute.
- Removes transitive dependency.
| Model | Structure | Feature |
|---|---|---|
| Hierarchical | Tree-like (parent → child) | One parent, many children. Fast but rigid. |
| Network | Graph (many-to-many links) | More flexible; complex structure. |
| Relational | Tables (rows and columns) | Most popular. Uses SQL. Easy to understand. |
| Centralized Database | Distributed Database |
|---|---|
| Stored at one single location | Stored across multiple locations |
| Easy to manage and maintain | Complex to manage |
| Single point of failure | No single point of failure |
| Lower cost | Higher cost |
| Slower access for remote users | Faster local access |
| Example: School database on one server | Example: Bank branches across the country |
Database security refers to protecting the database from unauthorized access, misuse, and threats.
Methods of Database Security
- Authentication: Verify user identity using username and password.
- Authorization: Grant or restrict access rights to specific users.
- Encryption: Convert data into unreadable format during storage/transfer.
- Backup and Recovery: Regular data backup to restore in case of failure.
- Audit Trail: Track all database activities to detect suspicious behavior.
Data Communication & Networking
Data communication is the transfer of data/information between two or more devices through a communication medium.
Elements of Data Communication
- Sender: The device that sends data (e.g., computer, phone).
- Receiver: The device that receives data.
- Message: The actual data/information being sent.
- Transmission Medium: The path through which data travels (e.g., cable, air).
- Protocol: A set of rules that govern data communication.
| Mode | Direction | Example |
|---|---|---|
| Simplex | One direction only | TV broadcast, keyboard → computer |
| Half Duplex | Both directions but not at same time | Walkie-talkie |
| Full Duplex | Both directions simultaneously | Mobile phone call |
Transmission medium is the physical path through which data signals travel from sender to receiver.
A. Guided Media (Wired)
Data travels through physical cables.
- Twisted Pair Cable: Two insulated copper wires twisted together. Cheap, used in telephone/LAN. Affected by noise.
- Coaxial Cable: Central conductor with shielding. Used in cable TV. Better noise resistance.
- Fiber Optic Cable: Transmits data as light. Very fast, long distance, immune to electromagnetic interference. Expensive.
B. Unguided Media (Wireless)
Data travels through the air.
- Radio Waves: Used in FM radio, WiFi. Passes through walls.
- Microwave: Line-of-sight transmission. Used in satellite communication.
- Infrared: Short range. Used in TV remotes.
| Star Topology | Bus Topology |
|---|---|
| All devices connect to a central hub/switch | All devices connect to a single main cable (bus) |
| If one device fails, others still work | If backbone cable fails, whole network fails |
| Easy to troubleshoot | Difficult to troubleshoot |
| More cabling required | Less cabling required |
| Higher cost | Lower cost |
| Used in modern LANs | Used in small/old networks |
| Client-Server | Peer-to-Peer (P2P) |
|---|---|
| Central server manages resources | All computers are equal, no central server |
| More secure and reliable | Less secure |
| Requires dedicated server (costly) | No dedicated server (cheaper) |
| Easy to manage | Difficult to manage in large networks |
| Example: School's computer lab | Example: File sharing between friends |
The OSI (Open Systems Interconnection) model is a conceptual framework that describes how different network protocols interact in seven layers.
| Layer | Name | Function |
|---|---|---|
| 7 | Application | Interface for user applications (HTTP, FTP) |
| 6 | Presentation | Data formatting, encryption, compression |
| 5 | Session | Manages sessions/connections between computers |
| 4 | Transport | End-to-end delivery (TCP/UDP) |
| 3 | Network | Routing and IP addressing |
| 2 | Data Link | Error detection, MAC addressing |
| 1 | Physical | Transmits raw bits over medium |
| LAN (Local Area Network) | WAN (Wide Area Network) |
|---|---|
| Covers small area (building/campus) | Covers large geographic area (cities/countries) |
| High speed (up to Gbps) | Slower speed |
| Low cost | High cost |
| Low error rate | Higher error rate |
| Example: College lab network | Example: Internet |
Web Technology II (JavaScript + PHP)
| Client-Side Scripting | Server-Side Scripting |
|---|---|
| Runs on user's browser | Runs on web server |
| Faster response (no server needed) | Slower (server processes first) |
| Code is visible to user | Code is hidden from user |
| Less secure | More secure |
| Example: JavaScript, HTML, CSS | Example: PHP, ASP, Python |
mysqli_connect() is a PHP function used to establish a connection to a MySQL database.
Syntax: mysqli_connect(host, username, password, database)
Parameters
- host: Server name — usually "localhost"
- username: Database user — usually "root"
- password: Password — often empty ("") for local
- database: Name of the database to connect to
PHP Variable Naming Rules
- Must start with a dollar sign:
$name - Can contain letters, numbers, and underscore
- Must start with a letter or underscore after
$ - Case-sensitive:
$Name≠$name - Cannot use reserved keywords (e.g.,
$echo)
PHP Data Types
- Integer — whole numbers:
$a = 5; - Float — decimal numbers:
$b = 3.14; - String — text:
$c = "Hello"; - Boolean — true/false:
$d = true; - Array — collection:
$e = array(1,2,3); - NULL — no value:
$f = null;
Programming in C
A function is a block of code that performs a specific task and can be called multiple times in a program.
Components of a Function
- Function Declaration (Prototype): Tells the compiler about the function name, return
type, and parameters. E.g.,
int add(int a, int b); - Function Definition: Actual code of the function.
- Function Call: Calling the function from main or another function. E.g.,
result = add(3, 5);
| Library Function | User-Defined Function |
|---|---|
| Pre-defined in C libraries | Defined by the programmer |
| Ready to use with #include | Must be written by user |
| Example: printf(), sqrt() | Example: add(), findMax() |
| Call by Value | Call by Reference |
|---|---|
| Copy of value is passed | Address (reference) is passed |
| Original value NOT changed | Original value IS changed |
| Safer, no side effects | Efficient for large data |
Binary file handling stores data in binary format (0s and 1s), not human-readable text. It is used to store structures, images, and complex data.
Key Functions
fopen(filename, "wb")— Open file for binary writingfopen(filename, "rb")— Open file for binary readingfwrite(&data, size, count, file)— Write binary datafread(&data, size, count, file)— Read binary datafclose(file)— Close the file
A pointer is a variable that stores the memory address of another variable.
- & (Address Operator): Returns the memory address of a variable. E.g.,
&agives address of a. - * (Indirection/Dereference Operator): Accesses the value at the address stored in a pointer.
Object-Oriented Programming (OOP)
| OOP | POP (Procedure-Oriented) |
|---|---|
| Focuses on objects and data | Focuses on functions/procedures |
| Data is encapsulated (secure) | Data is shared globally (less secure) |
| Supports inheritance, polymorphism | No inheritance or polymorphism |
| Code is reusable | Less code reusability |
| Top-down execution not needed | Follows top-down approach |
| Examples: Java, C++, Python | Examples: C, Pascal, COBOL |
Class
A class is a blueprint or template that defines the attributes (data) and behaviors (methods) of objects. It does not occupy memory by itself.
Object
An object is an instance (real occurrence) of a class. It occupies memory and has actual values.
Inheritance is an OOP feature where a child class acquires (inherits) properties and methods of a parent class. It promotes code reusability.
Types of Inheritance
- Single: One child inherits from one parent. (A → B)
- Multiple: One child inherits from multiple parents. (A, B → C)
- Multilevel: A chain of inheritance. (A → B → C)
- Hierarchical: Multiple children inherit from one parent. (A → B, A → C)
- Hybrid: Combination of two or more types.
Polymorphism means "many forms." In OOP, it allows the same method or operation to behave differently based on the object or context.
Types
- Compile-time (Method Overloading): Same method name, different parameters. E.g.,
add(int, int)andadd(float, float) - Runtime (Method Overriding): Child class redefines parent's method.
Advantages of OOP
- Code reusability through inheritance
- Data security through encapsulation
- Easier to debug and maintain
- Models real-world problems naturally
Software Process Model
SDLC (Software Development Life Cycle) is a process used to plan, design, develop, test, and deliver a software system.
Phases of SDLC
- 1. Planning: Define project scope, goals, and feasibility.
- 2. Requirement Analysis: Gather and document what the software must do.
- 3. System Design: Design architecture, modules, and database.
- 4. Implementation (Coding): Write the actual code.
- 5. Testing: Find and fix errors/bugs.
- 6. Deployment: Install and make software available to users.
- 7. Maintenance: Update, fix, and improve after release.
Requirement gathering is the process of collecting and documenting what a client or user needs from a software system.
Methods of Requirement Gathering
- Interview: Direct conversation with clients/users to understand needs.
- Questionnaire/Survey: Written set of questions distributed to many users.
- Observation: Analyst observes users doing their actual work.
- Document Review: Studying existing documents, reports, and manuals.
- Prototyping: Build a rough model and gather feedback.
- Brainstorming: Group discussion to generate ideas.
Waterfall Model
Sequential, linear model. Each phase must be completed before moving to the next. Easy to manage but not flexible to changes.
Phases: Planning → Analysis → Design → Coding → Testing → Deployment
Prototype Model
A working prototype (demo) is built first and shown to the client. Feedback is used to refine the prototype repeatedly until the final system is ready. Good when requirements are unclear.
Agile Model
Development is done in small iterations called sprints (2–4 weeks). Continuous feedback and testing. Flexible and customer-focused. Best for fast-changing requirements.
- Correctness: Performs the intended task accurately.
- Reliability: Works consistently without failure.
- Efficiency: Uses minimum resources (memory, CPU).
- Usability: Easy to learn and use by end users.
- Maintainability: Easy to update and fix bugs.
- Portability: Can run on different platforms/operating systems.
- Scalability: Can handle growing users or data without issues.
- Security: Protected against unauthorized access and threats.
A feasibility study is an evaluation done before starting a project to determine whether it is possible and worthwhile to develop.
Types
- Technical Feasibility: Does the organization have the technology, tools, and technical expertise to build it?
- Economic Feasibility: Is the project affordable? Will benefits outweigh costs?
- Operational Feasibility: Will users accept and use the system after it is built?
- Legal Feasibility: Does the project comply with laws and regulations?
Recent Trends in ICT
Artificial Intelligence
Artificial Intelligence (AI) is the simulation of human intelligence by machines. AI systems can learn, reason, solve problems, understand language, and make decisions.
Applications of AI in Education
- Personalized Learning: AI adapts content to each student's pace and learning style.
- Intelligent Tutoring Systems: AI tutors provide step-by-step guidance like a real teacher.
- Automated Grading: AI grades assignments and multiple-choice tests instantly.
- Chatbots: Answer student queries 24/7 without a teacher.
- Learning Analytics: Tracks student progress and predicts those who may fall behind.
- Content Creation: AI generates practice questions, summaries, and study materials.
Cloud Computing
Cloud computing is the delivery of computing services (servers, storage, databases, software) over the Internet ("the cloud") on a pay-as-you-use basis.
Service Models
| Model | Full Form | What you get | Example |
|---|---|---|---|
| IaaS | Infrastructure as a Service | Virtual hardware — servers, storage, networking | AWS EC2, Google Compute |
| PaaS | Platform as a Service | Platform to develop and deploy apps | Google App Engine, Heroku |
| SaaS | Software as a Service | Ready-to-use software over the internet | Gmail, Google Docs, Zoom |
Internet of Things (IoT) refers to a network of physical devices (things) embedded with sensors, software, and connectivity that allows them to collect and exchange data over the internet.
Applications of IoT
- Smart Home: Smart lights, thermostats, security cameras controlled remotely.
- Healthcare: Wearable devices monitor heart rate, blood pressure in real time.
- Agriculture: Sensors monitor soil moisture, weather, and automate irrigation.
- Transportation: GPS tracking, smart traffic management systems.
- Manufacturing: Machines monitor themselves and report issues automatically.
E-Commerce
E-Commerce (Electronic Commerce) is the buying and selling of goods and services over the internet. It eliminates the need for physical stores.
Types: B2B (business to business), B2C (business to consumer), C2C (consumer to consumer).
Examples: Amazon, eSewa, Daraz.com.np
Big Data
Big Data refers to extremely large and complex datasets that cannot be processed by traditional tools. Characterized by 3Vs:
- Volume: Huge amount of data
- Velocity: High speed of data generation
- Variety: Different types of data (text, video, sensor)
Used in: healthcare predictions, business analytics, social media analysis.
Virtual Reality (VR)
Virtual Reality is a computer-generated simulation of a 3D environment that users can interact with using special headsets or devices, making them feel "immersed" in a virtual world.
Applications: Gaming, medical training, military simulation, virtual tourism.
Robotics
Robotics is the science and technology of designing, building, and operating robots — machines that can perform tasks automatically or semi-automatically.
Applications: Industrial assembly, surgery, space exploration, hazardous environments (bomb disposal).
Netra Koirala
Computer Science Educator
Passionate computer science educator and author. Provides free study notes, practical guides, and tutorials for Class 9, 10, 11, 12, and B.Sc CSIT students in Nepal. Years of teaching experience in computer science fundamentals.
LinkedIn ProfileRelated Posts
Loading related posts…
Computer Science notes, tutorials, MCQs, and educational resources for Nepal students. Covering Class 9, SEE preparation, Class 11, Class 12, SLC, programming, DBMS, networking, HTML, JavaScript, PHP, OOP and more.
Featured Post
Grade 10 Computer Science: Specification Grid & Model Questions
Specification Grid & Model Questions of Computer Science | Grade 10 📚 Examination Resource Specification Grid & M...