-->

Sunday, May 4, 2025

NEB Computer Science 2082 | computer science Questions & Solved Answers

 



NEB-GRADE XII
2082 (2025) Computer Science

Sub.Code: 4281'D'

(For regular and partial students whose first two digits of registration

number starts from 78, 79, 80 and 81)

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

Time: 2 hrs.

Full Marks: 50

Multiple choice questions.
Group 'A' [9x1=9]   4281'D'

1. Which of the following is the purpose of using primary key in database? 

A) To uniquely identify a record

B) To store duplicate record

C) To backup data

D) To enhance database size

Ans:A) To uniquely identify a record

2. A company needs to modify an existing table by adding a new column for employee email addresses. For this, which SQL command should be used?

 A) CREATE

B) ALTER 

C) SELECT 

D) UPDATE


Ans:-B) ALTER 

3. Which protocol is used for secure communication over a computer network?

A) HTTP

B) FTP

C) HTTPS

D) Telnet


Ans:C) HTTPS


4. Which control structure in JS (Java Script) is used to execute a block of code repeatedly based on a given condition?

A) For loop

B) if-else

C) switch case 

D) function


Ans:-A) For loop

5. Select the invalid variable name in PHP.

A) $name

B) $_name

C) $1name

D) $name123

Ans:C) $1name

6. The statement int number (int a); is a ...

A) function call

B) function definition

C) function declaration

D) function execution


Ans:-C) function declaration

7. In which of the following programming, the emphasis is given on data rather than on procedures ?

A) Procedural programming

B) Structural programming

C) Object-oriented programming

D) Declarative programming


Ans:C) Object-oriented programming


8. Which type of feasibility study evaluates whether a system can be developed with the available technology?.

A) Operational feasibility

B) Social feasibility

C) Technical feasibility

D) Economical feasibility


Ans:-C) Technical feasibility

9. Which of the following is NOT a type of cloud computing service ?

A) Infrastructure as a Service (IaaS)

B) Platform as a Service (PaaS)

C) Software as a Service (SaaS) 

D) Hardware as a Service (HaaS)


Ans:-D) Hardware as a Service (HaaS)


Group 'B'[5x5=25]


Short answer questions

10. Write any three differences between DDL and DML. Give examples of each.                        [3+2]
            OR
What is normalization? Explain 2NF and 3NF.                                                                              [2+3]
11. Write JavaScript code to input any three numbers and find the smallest number among them.
            OR                                                                                                                                           [5]
Write a PHP script to connect to a MySQL database.                                                                        [5]
12. Write short notes on class and inheritance in oops.                                                                     [5] 
13. What is Requirement Gathering? Explain different Requirement Gathering
methods.                                                                                                                                             [1+4]
14. What is AI? Explain application areas of AI in education.                                                         [5]


Group 'C'
Long answer questions[2x8=16]

15. What is transmission medium? Explain its major types with advantages and disadvantages.[2+6] 
16. Write a C program that reads the account_number, name and address of ten customers from users and displays the account_number, name and address of these customers using Array and structure.
 OR                                                                                                                                                    [8]
What are the components of a function of C? Describe the Call - by - value and Call - by - reference and passing the function parameters.                                                                                                 [4+4]

 

-------------------------------------------------------------------------------------------------------------------------


NEB-GRADE XII
2082 (2025) Computer Science solutions

Sub.Code: 4281'D'

(For regular and partial students whose first two digits of registration

number starts from 78, 79, 80 and 81)

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

Time: 2 hrs.

Full Marks: 50

Multiple choice questions.
Group 'A' [9x1=9]   4281'D'

1. Which of the following is the purpose of using primary key in database? 

A) To uniquely identify a record

B) To store duplicate record

C) To backup data

D) To enhance database size

Ans:A) To uniquely identify a record

2. A company needs to modify an existing table by adding a new column for employee email addresses. For this, which SQL command should be used?

 A) CREATE

B) ALTER 

C) SELECT 

D) UPDATE


Ans:-B) ALTER 

3. Which protocol is used for secure communication over a computer network?

A) HTTP

B) FTP

C) HTTPS

D) Telnet


Ans:C) HTTPS


4. Which control structure in JS (Java Script) is used to execute a block of code repeatedly based on a given condition?

A) For loop

B) if-else

C) switch case 

D) function


Ans:-A) For loop

5. Select the invalid variable name in PHP.

A) Sname

B) $_name

C) $1name

D) $name123

Ans:C) $1name

6. The statement int number (int a); is a ...

A) function call

C) function declaration

B) function definition

D) function execution


Ans:-C) function declaration

7. In which of the following programming, the emphasis is given on data rather than on procedures ?

A) Procedural programming

C) Object-oriented programming

B) Structural programming

D) Declarative programming


Ans:C) Object-oriented programming


8. Which type of feasibility study evaluates whether a system can be developed with the available technology?.

A) Operational feasibility

B) Social feasibility

C) Technical feasibility

D) Economical feasibility


Ans:-C) Technical feasibility

9. Which of the following is NOT a type of cloud computing service ?

A) Infrastructure as a Service (IaaS)

B) Platform as a Service (PaaS)

C) Software as a Service (SaaS) 

D) Hardware as a Service (HaaS)


Ans:-D) Hardware as a Service (HaaS)


Group 'B'[5x5=25]


Short answer questions

10. Write any three differences between DDL and DML. Give examples of each.                        [3+2]

Ans:-

 The differences between DDL and DML are given below.

DDL

DML

DDL Stand For Data Definition Language

DML Stand for Data Manipulation Language

It is used to create the database schema

It is used to populate and manipulate database

CREATE, ALTER, DROP, TRUNCATE AND COMMENT and RENAME, etc

SELECT, INSERT, UPDATE, DELETE, MERGE, CALL, etc

SQL Statement can't be rollback

SQL Statement can be rollback

DDL Command affect the entire database or the table

Command affect one or more records in a table

Examples:

DDL:

CREATE TABLE Students (id INT, name VARCHAR(50));

DML:

INSERT INTO Students (id, name) VALUES (1, 'Sita');


            OR

What is normalization? Explain 2NF and 3NF.                                                                              [2+3]

Ans:-

Normalization:-

Normalization is the process of organizing data in a database to reduce data redundancy (repetition) and improve data integrity. It involves dividing large tables into smaller related tables and defining relationships between them. This makes the database more efficient and easier to maintain and removes all anomalies that may happen while inserting,updating,and deleting records.

2NF:-

Second Normal Form (2NF):

A table is in Second Normal Form (2NF) if:

  • It is already in First Normal Form (1NF), and

  • All non-key attributes are fully functionally dependent on the entire primary key (not just part of it, in case of a composite key).
    This removes partial dependency and helps avoid data duplication. 

Third Normal Form (3NF):

A table is in Third Normal Form (3NF) if:

  • It is in 2NF, and

  • There is no transitive dependency, meaning non-key attributes do not depend on other non-key attributes.
    This helps ensure that each non-key field is only dependent on the primary key.

11. Write JavaScript code to input any three numbers and find the smallest number among them.

            OR                                                                                                                                           [5]

Ans:-
<!DOCTYPE html>
<html>
<head>
  <title>Find Smallest Number</title>
</head>
<body>
<script>
  let num1 = parseFloat(prompt("Enter first number:"));
  let num2 = parseFloat(prompt("Enter second number:"));
  let num3 = parseFloat(prompt("Enter third number:"));
  let smallest = Math.min(num1, num2, num3);
  alert("The smallest number is: " + smallest);
</script>
</body>
</html>

OR

Write a PHP script to connect to a MySQL database.                                                                        [5]

Ans:-

 <?php

$connection = mysqli_connect("localhost", "root", "", "school");

if (!$connection) 

{

    echo"Connection failed: " . mysqli_connect_error();

}

else

{

echo "Connected successfully";

}

mysqli_close($connection);

?>

12. Write short notes on class and inheritance in oops.                                                                     [5] 

Ans:

Class:
In Object-Oriented Programming (OOP), a class is a blueprint or template for creating objects. It defines properties (called attributes or data members) and behaviors (called methods or functions) that the objects created from the class will have.

 For example, a Car class might have attributes like color and model, and methods like start() and stop(). Classes help in organizing code, promoting reuse, and improving readability.

example:-

 class Car 

{

private:

    string color="green":

    void color_car() 

{

        cout << " it is " << color<<endl;

    }

};

Inheritance:
Inheritance is an important feature of OOP that allows one class (called the child or subclass) to acquire the properties and behaviors of another class (called the parent or superclass). This helps in reusing existing code and creating a hierarchical relationship between classes. There are multiple types of inheritance like single inheritance, multiple imheritance,multilevel inheritance etc.

For example, a Dog class can inherit from an Animal class and automatically get its methods like eat() and sleep(). Inheritance promotes code reuse and reduces redundancy. 

class Animal {         

public:

    void eat() {

        cout << "Eating..." << endl;

    }

};

class Dog : public Animal {   

public:

    void bark() {

        cout << "Barking..." << endl;

    }

};

13. What is Requirement Gathering? Explain different Requirement Gathering.

Ans:-

Requirement gathering:

Requirement Gathering in the Software Development Life Cycle (SDLC) is the process of collecting detailed information about what a software system should do from stakeholders such as clients, users, and business analysts. It is the first and one of the most critical phases of SDLC, where the project's goals, features, functions, and constraints are clearly understood and documented. This ensures that the development team builds the right product that meets the user's needs and expectations.

Different methods of gathering:-

During the Analysis Phase of the Software Development Life Cycle (SDLC), various requirement gathering techniques help in accurately understanding user needs and system requirements. 

Here's how they contribute:

  1. Interviews

    • Directly engaging with stakeholders helps collect specific requirements, clarify user expectations, and uncover potential issues early on.

  2. Surveys and Questionnaires

    • Efficient for gathering feedback from a large number of users, identifying common needs, preferences, and concerns.

  3. Use Cases and User Stories

    • These techniques describe how users interact with the system, ensuring a focus on user-centric features and functionality.

  4. Workshops

    • Collaborative sessions with stakeholders allow for deeper discussions, prioritization of requirements, and consensus-building on key features.

  5. Prototyping

    • Developing prototypes helps stakeholders visualize the system early, refine requirements, and identify missing or misunderstood features.

                                                                                                                                           [1+4]

14. What is AI? Explain application areas of AI in education.                                                         [5]

Ans:-

Artificial Intelligence:

AI (Artificial Intelligence) refers to the capability of machines or software to simulate human intelligence. It involves the development of systems that can perform tasks such as learning, reasoning, problem-solving, and decision-making by analyzing data and adapting over time.

Its applications in the education are given below.

  1. Personalized Learning
    AI-driven systems analyze student performance and tailor content to individual learning styles and paces, helping students grasp concepts more effectively.

  2. Intelligent Tutoring Systems
    AI tutors provide real-time feedback and personalized assistance to students, helping them with subjects like math, science, and language by identifying areas of difficulty.

  3. Automated Grading
    AI can grade assignments and exams, especially for objective questions like multiple choice, short answers, and essays, reducing teachers' workload and providing faster feedback.

  4. Virtual Learning Assistants
    AI-powered chatbots or virtual assistants help students navigate courses, answer questions, and offer resources, making learning more accessible.

  5. Predictive Analytics
    AI uses data to predict student outcomes, such as identifying students at risk of underperforming, allowing for timely interventions and support.


Group 'C'
Long answer questions[2x8=16]

15. What is transmission medium? Explain its major types with advantages and disadvantages.[2+6] 

Ans:-

Transmission Medium:
A transmission medium is a physical path or channel through which data travels from the sender to the receiver in a communication system. It is the medium that carries the signals or data between different devices in a network. Transmission media can be wired (guided) or wireless (unguided).

We have mainly following types.

Under guided media, here are the pros and cons of  each media.

  1. Twisted Pair Cable (Wired):-A type of wired transmission medium where two insulated copper wires are twisted together to reduce electromagnetic interference.

    • Advantages:

      • Low cost compared to other mediums.

      • Easy to install and maintain.

    • Disadvantages:

      • Limited bandwidth and prone to interference.

      • Signal degradation over long distances.

  2. Coaxial Cable (Wired):- A type of wired transmission medium that consists of a central conductor, insulating layer, metallic shield, and outer insulation, offering better resistance to interference.

    • Advantages:

      • Higher bandwidth and better performance than twisted pair cables.

      • More resistant to interference and can cover longer distances without significant signal loss.

    • Disadvantages:

      • More expensive than twisted pair cables.

      • Bulky and harder to install compared to twisted pair cables.

  3. Fiber Optic Cable (Wired):A high-speed, wired transmission medium that uses light to transmit data through glass or plastic fibers, offering high bandwidth and low signal loss.

    • Advantages:

      • Very high bandwidth and extremely fast data transfer.

      • Immune to electromagnetic interference (EMI) and radio frequency interference (RFI).

    • Disadvantages:

      • Expensive to install and maintain.

      • Installation requires specialized equipment and expertise.

Under unguided media, here are the pros and cons of  each media.



  1. Radio Waves (Wireless):-A wireless transmission medium that uses electromagnetic waves to transmit data over short to long distances, often used in mobile communication and Wi-Fi.

    • Advantages:

      • Can transmit data over long distances without the need for wires.

      • Widely used for mobile communication, Wi-Fi, and Bluetooth.

    • Disadvantages:

      • Prone to interference from weather, buildings, and other electronic devices.

      • Limited bandwidth compared to wired media.


  2. Microwave (Wireless):-A wireless transmission medium that uses high-frequency radio waves to transmit data over long distances in a line-of-sight manner.

    • Advantages:

      • High data rates for point-to-point communication.

      • Suitable for long-distance communication with line-of-sight.

    • Disadvantages:

      • Requires line-of-sight between transmitter and receiver, limiting deployment.

      • Weather conditions (like rain) can affect signal quality.

  3. Satellite Communication (Wireless):-A wireless transmission medium that uses satellites in space to transmit and receive data across large geographical areas, such as for global communications and broadcasting.

    • Advantages:

      • Can cover very large geographical areas, even remote locations.

      • Used for global communication, TV broadcasting, and internet services.

    • Disadvantages:

      • High latency (signal delay) due to long-distance travel.

      • Expensive to set up and maintain.

[Write any two media.]


16. Write a C program that reads the account_number, name and address of ten customers from users and displays the account_number, name and address of these customers using Array and structure.
                                                                                                                                                  [8]

Ans:-


#include <stdio.h>
struct Customer
{
        int account_number;
        char name[50];
        char address[100];
};
int main()
{
        struct Customer customers[10];
        int i;
        for ( i = 0; i < 10; i++)
        {
            printf("Enter details for customer %d:\n", i + 1);
            printf("Account Number: ");
            scanf("%d", &customers[i].account_number);
            printf("Name: ");
            gets(customers[i].name);
            printf("Address: ");
            gets(customers[i].address);
            printf("\n");
        }
printf("\n Customer Details are:\n");
for (i = 0; i < 10; i++)
{
        printf("\nCustomer %d:\n", i + 1);
        printf("Account Number: %d\n", customers[i].account_number);
        printf("Name: %s", customers[i].name);
        printf("Address: %s", customers[i].address);
}
return 0;
}

OR

What are the components of a function of C? Describe the Call - by - value and Call - by - reference and passing the function parameters.                                                                                                 [4+4]

Ans:-

First part:-

Function:-

In C programming, a function is a block of code that performs a specific task. It allows us to break down a program into smaller, manageable parts. Functions are used to reuse code, make programs more organized, and improve readability.

In C programming, a function typically consists of the following components:

1. Function Name/prototype:

 Also called function prototype, it is an identifier used to declare the function. It should be descriptive and follow the naming conventions with or without parameters.

            example:  void sum();
            Here, sum() is a function prototype with return type void.

2. Return Type

Specifies the type of value that the function will return to the caller. It can be any valid C data type, such as int, float, char, or void (for no return value).
        Example:   
         return sum;

3.Parameters/Arguments (Optional):

 These are the values passed to the function when called. Parameters define the input for the function and are listed in the parentheses after the function name.
            int sum(float a ,float b);
            Here, we have two parameters a and b.

4. Body/function definition

This contains the actual code that defines what the function does. It is enclosed within {} and may include local variables, loops, conditional statements, etc. It is called function definition part where we define many things.
        Example:
            void sum(float a,float b)
            {
                float s;
                s=a+b; 
            }

5. Function call: 

AS we write all the statements inside the functions, as per demand, we call them from particular function or main function to get its output. It is called function calling. To call the function, we simply put function name, with or without parameters.


Example:
int main()
{ sum(3,4);//calling of function
}
 void sum(float a,float b)// it is definition part
   {
                float s;
                s=a+b; 
   }

Second part:

Call by Value:-

In Call by Value, a copy of the actual argument is passed to the function. Changes made to the parameter inside the function do not affect the actual argument.

Example:

#include <stdio.h>
void add(int a, int b) ;//prototype
int main() 
{

int x = 5, y = 10;
add(x, y); 
printf("x = %d, y = %d (unchanged)\n", x, y);
return 0;
}
void add(int a, int b) 
{
a = a + b; 
printf("Sum inside function: %d\n", a);
}

Call by Reference:-

In Call by Reference, the address of the actual argument is passed to the function, so any changes made to the parameter will affect the actual argument.

Example:

#include <stdio.h>
void add(int *a, int *b) ;//prototype
int main()
{
int x = 5, y = 10;
add(&x,&y);
printf("x = %d, y = %d (changed)\n", x, y);
return 0;
}
void add(int *a, int *b)
{
*a = *a + *b;
printf("Sum inside function: %d\n", *a);
}