NEB Class 12 · Past paper
The complete NEB Class 12 2078 exam paper for Computer Science, all 15 questions with solved model answers.
Tap a question to open its answer.
(a) Describe the switch statement with example. (b) Demonstrate the FOR loop with example.
(a) The switch statement. switch is a multiway selection statement in C. It evaluates an integer or character expression once and transfers control to the case label whose constant matches that value, which is clearer than a long chain o...
What is array ? Write a program to input any 10 numbers in an array and display it.
An array is a collection of a fixed number of elements of the same data type stored in consecutive memory locations under a single name. Each element is reached by an index, and in C the index always starts at 0, so an array declared as ...
(a) Define 'function' in C. Write a program to calculate the factorial of given number using function.
A function in C is a self contained block of statements with a name, which performs one well defined task and can be called from anywhere in the program. It may take values through its parameters and may send a value back with return. A ...
Why do you use structure ? Write a program to input teacher id, name address and subject of 10 teachers and display them properly using structure.
A structure is used because an array can hold only values of one type, while a real world record is made of several different types. A teacher has a numeric id, a name, an address and a subject, that is an int and three strings, and no s...
What is pointer ? write a program to enter the name, mobile and post of employee and write it in file " worker.dat" in C program.
A pointer is a variable that holds the memory address of another variable rather than a value of its own. If p stores the address of an integer b, then p is declared int p; and set with p = &b;, where & is the address of operator. The va...
Write a short description about common phases of SDLC.
The Software Development Life Cycle (SDLC) is the sequence of well defined phases through which a software product passes from the first idea to its retirement. Its common phases are the following. Problem definition and feasibility stud...
Explain the different types of integrity constraints in DBMS.
Integrity constraints are the rules a database applies to the data before accepting it, so that the database stays accurate and consistent. They are declared once with the schema and the DBMS then enforces them automatically, rejecting a...
Explain the Entities Relation Diagram with real example.
An Entity Relationship Diagram (ERD) is a graphical model of the logical structure of a database. It shows the things the organisation stores data about, the facts recorded about each of them, and the associations among them, and it is d...
Compare the Coaxial, UTP and Optical cable.
All three are guided transmission media, but they differ in construction and hence in bandwidth, reach and cost. Coaxial cable has a solid copper core at the centre, wrapped in an insulator, then a braided metallic shield and finally a p...
Describe an OSI reference model.
The OSI (Open Systems Interconnection) reference model was published by the ISO in 1984 as a standard framework for network communication. It divides the whole job of moving data between two machines into seven layers, each with a define...
What are the logical operators in C ? Explain with an example.
Logical operators in C combine or invert conditions and yield a result that is either 1 for true or 0 for false. They are used to build a compound condition out of simpler relational tests, typically inside an if statement or a loop. C provides three.
Logical AND (&&) gives true only when both its operands are true. (a > 0 && b > 0) is true only if both numbers are positive.
Logical OR (||) gives true when at least one of its operands is true, and false only when both are false. (ch == 'y' || ch == 'Y') is true for either case of the letter.
Logical NOT (!) is a unary operator that reverses the truth of its operand, so !(a == b) is true exactly when a is not equal to b.
Their truth table, with any non zero value counting as true:
| a | b | a && b | a || b | !a |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 |
An important property is short circuit evaluation: in && the second operand is not evaluated at all if the first is false, and in || it is not evaluated if the first is true, since the answer is already settled.
#include <stdio.h>
int main() {
int year;
printf("Enter a year: ");
scanf("%d", &year);
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
printf("%d is a leap year.\n", year);
else
printf("%d is not a leap year.\n", year);
return 0;
}
The condition uses all the ideas together. A year is a leap year if it is divisible by 4 and not by 100, which is the first bracket joined by &&, or if it is divisible by 400, which is the second bracket joined by ||. For 2000 the first bracket is false (2000 is divisible by 100) but the second is true, so the whole condition is true. For 1900 both brackets are false and the year is not a leap year. For 2024 the first bracket is true, and because || short circuits, the second is never tested.
Describe the object-oriented concept in programming.
Object oriented programming (OOP) is a way of writing programs in which the program is organised as a collection of objects that hold their own data and the operations on that data, and interact by sending messages to one another. It rep...
Explain the Artificial Intelligence and its applications.
Artificial Intelligence (AI) is the branch of computer science concerned with building machines and programs that can perform tasks which would ordinarily require human intelligence, such as learning from experience, reasoning to a concl...
How do you protect yourself from the cybercrime ? Suggest.
Cybercrime is any criminal act committed with a computer or a network as the tool or the target, such as hacking, phishing, identity theft, online fraud, spreading malware, cyberbullying and the theft of data. Protecting oneself is large...
Write short notes on: a) e-Governance b) Data security
(a) e-Governance.
e-Governance is the use of information and communication technology, chiefly the internet, by a government to deliver its services and information to citizens, businesses and its own agencies, and to conduct its internal administration. Its aim is to make government more efficient, transparent, accountable and accessible, reducing the paperwork, the delay and the opportunities for corruption that attend a manual office, and letting a citizen deal with the government without travelling to it.
Its four interactions are commonly distinguished as G2C (government to citizen), such as applying online for a citizenship certificate, passport, licence or utility bill payment; G2B (government to business), such as company registration, e-tendering and online tax filing; G2G (government to government), the exchange of data between departments and between central and local bodies; and G2E (government to employee), covering payroll, records and training for staff.
In Nepal it appears in the online passport and driving licence systems, the PAN and VAT filing of the Inland Revenue Department, the Public Service Commission's online application, land record computerisation and the official portals of the ministries. The benefits are speed, lower cost, transparency and round the clock availability. The obstacles are limited internet access and electricity in rural areas, low computer literacy, the cost of infrastructure, resistance from staff accustomed to manual work, and the need to keep citizens' data secure.
(b) Data security.
Data security means protecting data from unauthorised access, alteration, disclosure or destruction, whether accidental or deliberate, throughout its life. It rests on three goals, together called the CIA triad: confidentiality, that only authorised people can read the data; integrity, that the data is not altered by anyone not authorised to do so and is accurate; and availability, that it is there when the authorised user needs it.
The threats it guards against include hacking and unauthorised access, viruses and other malware, ransomware, theft or loss of a device, insider misuse, and simple hardware failure or natural disaster.
The measures used are authentication by password, smart card or biometrics to establish who the user is, and authorisation with access rights so that each user reaches only the data the work requires; encryption, which turns readable data into cipher text that is useless without the key, both in storage and in transit; firewalls and antivirus software to keep intrusions and malware out; regular backups kept in a separate place, which is the only protection against destruction of data; audit trails that record who did what and when; and physical security such as locked server rooms, controlled entry and an uninterruptible power supply. Legal protection is provided in Nepal by the Electronic Transaction Act, 2063, which makes unauthorised access to and damage of data a punishable offence.