Thursday, April 17, 2025

NEB Grade 12 Preparation Examination - 2081

 

NEB Preparation Examination - 2081

Subject: Computer Science

Grade 12



Candidates are required to give their answers in their own words as far as practicable. The figures in the margin indicate full marks

Group A: Multiple Choice Questions.

Tick / Select the best alternative. [9 x 1 = 9 ]

1) Which of the following is not an example of DBMS?

  a. MySQL    b. Google      c. IBM DB2   d. MS- Access   

2) Correct code to display “Scripting Language”?

  a. System.out.println      b. println      

  c. response.write             d. document.write

3) What will be the output of following JavaScript code?

var A= "ABC";

var B="College";

document.write(A+B);

  a. ABC          b. ABCCollege                     c. ABC Collegee       d. CollegeABC

4) What is the output of given C program?

int a = 9 , b = 42;

printf("%d",a>b);

printf("%d",a<b);

  a. 0 0                        b. 0 1              c. 1 0              d. 1 1

5) IoT stands for...

  a. Internet of Thumb                               b. Internal of things                       

  c. Internet of though                               d. Internet of things

 

6) What identifies a row in a table as unique?

  a. Main Key                        b. Regular Key              c. Primary Key     d. Foreign Key

7) Hardware component without which a computer cannot be connected over a network.

  a. Modem                           b. Router      

  c. NIC                                   d. Bridge

8) ..................is a process where you show only "relevant" data and "hide" unnecessary details of an object from the user.

  a. Abstraction                   b. Polymorphism   

  c. Inheritance                                d. Encapsulation

9) ... ... ... is the use of various services, such as software development platforms, servers, storage, and software, over the Internet.

  a. SDLC                                b. e-commerce       

  c. e-business                                  d. Cloud Computing

 

Group B - Short answer Questions

Short answer questions. [5×5=25]

10. What is data security? How it can be implemented? [2+3]

Ans: Data security refers to the protection of data from unauthorized access, use, disclosure, disruption, modification, or destruction. It aims to ensure the confidentiality, integrity, and availability of information.  

Data security can be implemented through various measures as:

  • Access Control: Using passwords, biometrics, and permissions to restrict who can access data.
  • Encryption: Converting data into an unreadable format to protect it during storage and transmission.
  • Firewalls: Creating a barrier between trusted and untrusted networks to block malicious traffic.
  • Intrusion Detection and Prevention Systems: Monitoring network activity for suspicious behavior and taking action to prevent attacks.
  • Regular Backups: Creating copies of data to allow for recovery in case of data loss.
  • Security Audits: Regularly assessing security measures to identify vulnerabilities and ensure effectiveness.
  • Employee Training: Educating users about security best practices and potential threats.

 

OR

Differentiate between client-server and peer-to-peer architecture.

Ans:

Client-Server Network

Peer-to-Peer Network

Data is typically stored in a centralized server.

Every peer holds its own data.

In a Client-Server network, the server responds to the service requests made by the client.

In a Peer-to-Peer network, each node can both request and provide services.

A Client-Server network is more expensive than a Peer-to-Peer network.

A Peer-to-Peer network is more cost-effective than a Client-Server network.

They provide a more stable network configuration.

They offer less stability in comparison.

They can be employed in both small and large networks.

They are mainly used for smaller networks.

 

11. What is JavaScript? Write a function to multiply any two numbers in JavaScript.

Ans: JavaScript is a dynamic, interpreted, and high-level programming language primarily used to add interactivity to web pages. It allows us to create dynamically updating content, control multimedia, animate images, and much more, enhancing the user experience.

 

<html>

<head>

            <title>javascript</title>

            <script>

            function multiply(a,b){

            const m=a*b;

            document.write("Mulitplication of two number= "+m);

            }

            </script>

</head>

<body>

            <script>

            var a= parseInt(prompt("Enter first number"));

            var b = parseInt(prompt("Enter Second number"));

            multiply(a,b);

            </script>

</body>

</html>

OR

Write a JavaScript program to check whether the given number is prime or composite. (5)

Solution:

<html>

<head>

            <title>javascript</title>

            <script>

            var c=0;

            function primecomposite(n){

            for(var i=1; i<=n;i++){

            if (n%i ==0){

            c++;

            }}

            if (c<=1){

            document.write("Neither prime or composite");

            }else if (c==2){

            document.write("Number is prime");

            }else{

            document.write("Number is composite");

            }}

            </script>

</head>

<body>

            <script>

            var n= parseInt(prompt("Enter a number"));

            primecomposite(n);

            </script>

</body>

</html>

 

12. Explain the last two stages of system development life cycle.

Ans: The last two stages of SDLC are:

1.     Implementation (Deployment)

o   The developed system is installed and made operational.

o   Data migration from old to new system occurs.

o   User training is provided.

o   Types: Direct, Parallel, Phased, Pilot cutover.

2.     Maintenance & Support

o   Fixing bugs and improving performance.

o   Regular updates and security patches.

o   User feedback is incorporated for enhancements.

o   Continues until the system is replaced or retired.


 

13. Explain the different characteristics of Object-oriented Programming (OOP)?

Ans: The different characteristics of Object-oriented programming are:

1. Objects: Objects are the fundamental building blocks of OOP. They are instances of classes and represent real-world entities or abstract concepts. An object encapsulates both data (attributes) and the methods (behavior) that operate on that data.

2. Classes: A class is a blueprint or a template that defines the structure and behavior of objects of that type. It specifies the attributes (data members) that an object will have and the methods (member functions) that an object can perform.

3. Encapsulation: This principle bundles data (attributes) and methods (functions) that operate on that data into a single unit called a class or object. This bundling hides the internal implementation details from the outside world, protecting the data and promoting modularity. 

4. Inheritance: This principle allows classes to inherit properties and methods from other classes (parent or superclass). This promotes code reusability and reduces redundancy. 

5. Polymorphism: This principle enables objects of different classes to respond to the same method call in their own specific ways. This allows for flexibility and adaptability in code. 

6. Abstraction: This principle simplifies complex reality by focusing on essential features and hiding unnecessary implementation details. This makes the code easier to understand and use. 

 

14. Define IOT and Big data with its advantage.

Ans: The Internet of Things (IoT) describes a network of physical objects ("things") embedded with sensors, software, and other technologies that enable them to collect and exchange data over the internet.

Advantages of IoT are:

1.     It increases the efficiency and productivity of work.

2.     It helps to automate our daily life work.

3.     It can be used as entertainment enhancing user experience.

4.     It helps to communicate and exchange data and information in real-time.

 

Big data refers to massive, diverse datasets that are difficult to manage using traditional database tools. It's characterized by volume, variety, velocity, and variability. The main advantage of big data is the ability to gain insights and improve decision-making across various industries. 

Advantages of Big Data are:

1.     Enables predictive analytics and trend analysis.

2.     Helps businesses tailor products/services to customer preferences.

3.     Identifies unusual patterns and behaviors in real-time.

4.     Optimizes supply chains, inventory, and processes.

5.     Supports new product development and strategic planning.

Group C - Long answer Questions

Long answer questions. [8×2=16]

15. What do you mean by topology? Explain Bus, Star and Ring Topology with their diagrams. (2+6)

Ans: Topology refers to the physical or logical arrangement of nodes and the connections between them in a network. It defines the structure of how data is transferred within the network. The choice of topology can significantly impact the network's performance, reliability, and cost.

1. Bus Topology: In a bus topology, all devices in the network are connected to a single cable, called the bus or backbone. Data is transmitted along this bus, and all devices on the network receive the signal. However, only the device with the intended address will process the data. A terminator is placed at each end of the bus to prevent signal reflection.

Lightbox

Advantages:

·      Easy to set up and cost-effective.

·      Requires less cabling.

Disadvantages:

·      If the main cable fails, the entire network goes down.

·      Performance degrades with heavy traffic.

 

2. Star Topology: In a star topology, all devices in the network are connected to a central hub or switch. All communication between devices passes through this central point. A device wanting to communicate with another device sends the data to the hub/switch, which then forwards it to the intended destination.

What is Star Topology? | GeeksforGeeks

Advantages:

·      If one cable or device fails, the rest of the network remains unaffected.

·      New devices can be easily added by connecting them to the central hub/switch.

Disadvantages:

·      If the central hub or switch fails, the entire network goes down.

·      Requires more cable and a central connecting device (hub or switch), which can be expensive.

 

3. Ring Topology: In a ring topology, each device is connected to exactly two other devices, forming a closed loop or ring. Data travels around the ring in one direction, from one device to the next, until it reaches the intended destination. Each device acts as a repeater, forwarding the signal to the next device in the ring.

Difference between Ring Topology and Tree Topology | GeeksforGeeks

Advantages:

·      No data collisions (orderly transmission).

·      Works well under heavy traffic.

Disadvantages:

·      A single node failure can break the entire loop.

·      Adding/removing nodes disrupts the network.

 

16. Write a C program to store registration number, name and marks of 3 subjects using structure and display them in ascending order on the basis of registration number. (8)

Solution:

#include <stdio.h>

#include<conio.h>

#include <string.h>

struct Student {

    int regNo;         

    char name[50];

    float marks[3]; 

};

void main() {

    int n, i, j;

    printf("Enter the number of students: ");

    scanf("%d", &n);

 

    struct Student stu[n], temp;

 

    for (i = 0; i < n; i++) {

        printf("\nEnter details for student %d:\n", i + 1);

        printf("Registration Number: ");

        scanf("%d", &stu[i].regNo);

        printf("Name: ");

        scanf("%s", stu[i].name);

        printf("Marks of 3 subjects: ");

        scanf("%f %f %f", &stu[i].marks[0], &stu[i].marks[1], &stu[i].marks[2]);

    }

 

    for (i = 0; i < n ; i++) {

        for (j = 0; j < n; j++) {

            if (stu[j].regNo > stu[j + 1].regNo) {

                temp = stu[j];

                stu[j] = stu[j + 1];

                stu[j + 1] = temp;

            }

        }

    }

 

    printf("\nStudent Details (Sorted by Registration Number):\n");

    printf("Reg No\tName\t\tMarks (Sub1, Sub2, Sub3)\n");

    for (i = 0; i < n; i++) {

        printf("%d\t%s\t\t%.2f, %.2f, %.2f\n",

               stu[i].regNo,

               stu[i].name,

               stu[i].marks[0],

               stu[i].marks[1],

               stu[i].marks[2]);

    }

 

getch();

}

 

OR

Write a program in C to create a data file “score.txt” which stores Student ID, Name, marks of computer as per need of user. After that display all the records of file “score.txt”. (8)

Solution:

#include <stdio.h>

#include<conio.h>

 

struct Student {

    int id;

    char name[50];

    float computerMarks;

};

 

int main() {

    FILE *ptr;

    int n, i;

 

    ptr = fopen("score.txt", "w");

    printf("Enter the number of students: ");

    scanf("%d", &n);

 

    struct Student s;

 

    for (i = 0; i < n; i++) {

        printf("\nEnter details for student %d:\n", i + 1);

        printf("Student ID: ");

        scanf("%d", &s.id);

        printf("Name: ");

        scanf("%s", s.name);

        printf("Computer Marks: ");

        scanf("%f", &s.computerMarks);

 

        fprintf(ptr, "%d %s %.2f\n", s.id, s.name, s.computerMarks);

    }

    fclose(ptr);

 

    printf("\nDisplaying records from score.txt:\n");

    printf("ID\tName\tComputer Marks\n");

    ptr = fopen("score.txt", "r");

 

    while (fscanf(ptr, "%d %s %f", &s.id, s.name, &s.computerMarks) != EOF) {

        printf("%d\t%s\t%f\n", s.id, s.name, s.computerMarks);

    }

 

    fclose(ptr);

    return 0;

}

 

The End