-->
Showing posts with label NEB grade 12 computer science. Show all posts
Showing posts with label NEB grade 12 computer science. Show all posts

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);
}

Wednesday, May 8, 2024

NEB computer science || Grade 2081 questions and solutions

 NEB computer science 2081 questions with solutions

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



 

NEB-GRADE XII
2081 (2024)

Computer Science                                                                                                                                            Sub.Code: 4281

(New course)

(For the regular and grade increment students whose first two digits of registration number starts from 78, 79 and 80)

Multiple Choice Questions [9x1=9]

Rewrite the correct option of each question in your same answer sheet.

Group 'A'

1. Which one of the followings given statement correct?

A) Select * from enp where eopid = 103;

B) Select from enp where eopid = 103;

C) Select eopid where enp = 103 from emp;

D) Select eopid where eopid = 103 and table = emp;

Ans: A) Select * from enp where eopid = 103;

2. Which database system normally offers better performance for geographically dispersed users ?

A) Centralized database system B) Distributed database system

C) NoSQL database system           D) Relational database system

Ans:-B) Distributed database system

3. Which of the following is an example of a public IPV4 address?

A) 192.168.1.1                                                  B) 172.16.10.1

C) 10.10.10.10                                                  D) 203.0.113.10

Ans:- D) 203.0.113.10

4. What is the correct syntax for a 'for-loop' in JavaScript?

A) for (var i=0; i<5; i++){}                              B) for (i=0; i<5; i++) {}

C) for (var i=0; i<5) {}                                       D) for (var i<5; i++) {}


Ans:-A) for (var i=0; i<5; i++){}   

5.Which PHP function is commonly used to execute SQL queries on a database connection established using mysqli extension ?

A) mysqli_query()                                           B) pdo_query()

C) mysql_query()                                             D) pgsql_query()

 

Ans:-A) mysqli_query()    

6.What is the correct syntax to declare a structure in C?

A) struct { }                          B) define struct {}

c) struct [ ]                             D) struct <name> {}


Ans:- D) struct <name> {}

7. In C, which operator is used to get the address of a variable?

                A)*                                                         B) &

C)->                                                        D).


Ans:-B) &

8. Which OOP feature allows a class to inherit properties and behavior from another class?

A) Inheritance                                                   B) Encapsulation

C) Polymorphism                                              D) Abstraction


Ans:-A)Inheritance

9. Which model of SDLC is characterized by a linear progression of phases from requirements gathering to maintenance ?

A) Waterfall model                         B) Agile model

C) Spiral model                                  D) RAD model


Ans:-A)Waterfall model

Group 'B'
Short answer questions [5x5=25]

10. Evaluate the advantages of DBMS compared to traditional file-based data storage systems.
OR                                                                                                                                    [5]
How does Second Normal Form (2NF) differ from First Normal Form (INF), and what are the key benefits of achieving 2NF in database design? Explain.                                                                                                                                [2+3]
11. Write a JavaScript function that checks if a number is even or odd and print the result. [1+4]
OR
What is purpose of the mysqli_connect() function in PHP? Describe its usage and parameters. [2+3]
12. Write short note on class and object in OOPS with a real-word example.           [2.5+2.5]
13. How do various requirement gathering techniques help in achieving a careful grasp of user needs and system requirements during SDLC's analysis phase?                                                                                                                                      [5]
14. Give five examples of AI applications in the education.                                                                                                                              [5]

Group 'C'[12×8-16]
Long answer questions

15. How does the star network topology differ from the bus network topology in terms of its architectural layout and data transmission methodology in modern computing environments?[8]
 16. Write a C program that uses structures to represent details of five books title, author, publisher and price) and prints them out.                                                                                       [8]
OR
Discuss the concept of binary file handling in C programming and explain how putw() and getw() functions facilitate binary input/output operations. Give examples.                                                [8]

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


Solutions:

 NEB computer science || grade 12 computer science 2081 questions with solutions

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



 

NEB-GRADE XII
2081 (2024)

Computer Science                                                                                                                                            Sub.Code: 4281

(New course)

(For the regular and grade increment students whose first two digits of registration number starts from 78, 79 and 80)

Multiple Choice Questions [9x1=9]

Rewrite the correct option of each question in your same answer sheet.

Group 'A'

1. Which one of the followings given statement correct?

A) Select * from enp where eopid = 103;

B) Select from enp where eopid = 103;

C) Select eopid where enp = 103 from emp;

D) Select eopid where eopid = 103 and table = emp;

2. Which database system normally offers better performance for geographically dispersed users ?

A) Centralized database system B) Distributed database system

C) NoSQL database system           D) Relational database system

3. Which of the following is an example of a public IPV4 address?

A) 192.168.1.1                                                  B) 172.16.10.1

C) 10.10.10.10                                                  D) 203.0.113.10

4. What is the correct syntax for a 'for-loop' in JavaScript?

A) for (var i=0; i<5; i++){}                              B) for (i=0; i<5; i++) {}

C) for (var i=0; i<5) {}                                       D) for (var i<5; i++) {}

5.Which PHP function is commonly used to execute SQL queries on a database connection established using mysqli extension ?

A) mysqli_query()                                           B) pdo_query()

C) mysql_query()                                             D) pgsql_query()

 

6.What is the correct syntax to declare a structure in C?

A) struct { }                          B) define struct {}

) struct [ ]                             D) struct <name> {}

7. In C, which operator is used to get the address of a variable?

                A)*                                                         B) &

C)->                                                        D).

8. Which OOP feature allows a class to inherit properties and behavior from another class?

A) Inheritance                                                   B) Encapsulation

C) Polymorphism                                              D) Abstraction

9. Which model of SDLC is characterized by a linear progression of phases from requirements gathering to maintenance ?

A) Waterfall model                         B) Agile model

C) Spiral model                                  D) RAD model

Group 'B'
Short answer questions [5x5=25]

10. Evaluate the advantages of DBMS compared to traditional file-based data storage systems.

Ans:-

Here are some advantages of DBMS over traditional file based system.

1. Redundancy is reduced

  • File-based systems: Often store the same data in multiple files (redundancy).

  • DBMS: Uses centralized control to minimize duplication through normalization and relational structure.

2. Data consistency and integrity
      File based system: It is difficult to maintain because data is stored in multiple places
      DBMS:Enforces rules (primary key,foreign key etc)to maintain integrity od data
3.data security
     File based system: It does not have inbuilt security system
    DBMS:It has security such as role based access,authentication,permission controls
4.Data sharing:
     File based system: It does not have inbuilt security system
    DBMS:It has security such as role based access,authentication,permission controls.
5.Backup and recovery:
     File based system: It has manual and error-prone backup process.
    DBMS:It has automated backup system with recovery tools.

OR                                                                                                                                    [5]

How does Second Normal Form (2NF) differ from First Normal Form (INF), and what are the key benefits of achieving 2NF in database design? Explain.                                                                                                                                [2+3]

Ans:-

To understand the difference between 1NF and 2NF, lets understand about them in detail with example.

1NF:

A table is said to  be in 1NF if it satisfies the following conditions.

1. If it contains no repeating fields such as phone1,phone2 in different columns.

2.If each column contains indivisible data i.e atomic or single valued data.

       StudentIDNameSubjects
         101RamMath, Science
         102SitaEnglish, Nepali
This is not in 1NF. because subjects contain multivalued data.  NOw converting this into 1NF,

                         StudentIDNameSubject
                          101RamMath
                         101RamScience
                        102SitaEnglish
                         102SitaNepali
2NF:- A table is said to be in 2NF if it satisfies the following conditions.
1. If it is in 1NF.
2. If all non-key attributes are fully functionally dependent on the entire primary key, not just part of it. i.e no partial dependency should be there.
 example:
StudentIDCourseIDStudentNameCourseName
1C101RamMath
2C102SitaScience

Here StudentID+CourseID is being primary key.In this table the filed CourseName is dependent on CourseID and StudentName is depedent on StudentID, not fully on both. So there is being partial dependency.

Now breaking this into tables such as

studentcourse

StudentIDCourseID
1C101
2C102

students

StudentIDStudentName
1Ram
2Sita

courses

CourseIDCourseName
C101Math
C102Science

So these tables are in 2NF.

key benefits of 2NF:

1.Eliminate partial dependency

2.reduces data redundancy

3.optimizes storage

4. improves query efficiency

11. Write a JavaScript function that checks if a number is even or odd and print the result. [1+4]

Ans:-

<script>

function checkEvenOrOdd() 

{

  let number = parseInt(prompt("Enter a number:"));

   if (number % 2 === 0)

   {

    console.log(number + " is even.");

  } 

  else

  {

    console.log(number + " is odd.");

  }

}

checkEvenOrOdd();

</script>



OR

What is purpose of the mysqli_connect() function in PHP? Describe its usage and parameters. [2+3]

Ans:-

The mysqli_connect() function is used to establish a connection to a MySQL database using the MySQLi (MySQL Improved) extension in PHP.

Syntax:

mysqli_connect(host, username, password, database, port, socket);

  Here, port and socket are optional.  all other parameters' meaning are given below.
ParameterDescription
hostThe hostname or IP address of the MySQL server (e.g., "localhost").
usernameMySQL username (e.g., "root").
passwordPassword for the MySQL user. Mostly it is empty.
databaseName of the database to connect to.


Example:

         <?php

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

if (!$connection) {

    die("Connection failed: " . mysqli_connect_error());

}

echo "Connected successfully";

?>


12. Write short note on class and object in OOPS with a real-word example.           [2.5+2.5]

Ans:-

Class and Object in OOPS

In Object-Oriented Programming (OOP), classes and objects are fundamental concepts.

  • Class:
    A class is a blueprint or template for creating objects. It defines the properties (attributes) and behaviors (methods) that objects created from the class will have.

    • Example: A Car class might have properties like color, model, and speed, and methods like accelerate() and brake().

  • Object:
    An object is an instance of a class. It represents an entity with specific values for the class’s attributes and can perform actions defined by the class’s methods.

    • Example: A specific car like a "red Ferrari" is an object of the Car class.

Programming example in C++:

            class student{ private:int id; public:void getdatat(){ }} ;
            int main()
            {
                student obj;obj.getdata();
            }
    Here, obj is an object. student is a class.

13. How do various requirement gathering techniques help in achieving a careful grasp of user needs and system requirements during SDLC's analysis phase?                                                                                                                                      [5]

Ans:

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.


14. Give five examples of AI applications in the 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'[12×8-16]
Long answer questions

15. How does the star network topology differ from the bus network topology in terms of its architectural layout and data transmission methodology in modern computing environments?[8]

ans:-

Star topology:

In a Star Topology, all devices (nodes) are connected to a central hub or switch. Communication between devices always passes through this central device.



Transmission methodology:

In a modern transmission methodology, each device sends data to a central hub or switch, which then forwards it to the intended destination device. Unlike older shared communication systems, modern networks utilize switched communication that operates on a point-to-point basis. This approach significantly reduces data collisions, as each connection is given a dedicated communication path within the switch. As a result, there is minimal interference between devices.

Advantages of Star Topology

  1. Easy to Manage and Troubleshoot

    • Since each device is connected individually to the central hub/switch, it's easy to detect and fix issues.

  2. Fault Isolation

    • Failure in one cable or device doesn't affect the rest of the network.

Disadvantages of Star Topology

  1. Dependency on Central Hub/Switch

    • If the hub or switch fails, the whole network becomes inoperative.

  2. Higher Cost

    • Requires more cable length and additional hardware like switches or hubs, making it costlier than bus topology.


Bus topology:-

Bus topology is a network setup where all devices (nodes) are connected to a single central cable, called the bus or backbone. Data sent by a device is broadcasted along this cable and received by all connected devices.



Transmission mechanism:-

In broadcast transmission, data travels both ways on a shared bus, where all devices receive it, but only the intended one accepts it. The CSMA/CD protocol manages this by checking if the bus is free before sending. If two devices transmit at once, a collision occurs, prompting both to wait randomly before retrying.

Advantages of Bus Topology

  1. Cost-Effective

    • Requires less cabling compared to star topology. No need for extra devices like switches or hubs.

  2. Easy to Set Up

    • Simple layout and minimal hardware make it easy to install and configure, especially for small networks.

Disadvantages of Bus Topology

  1. Limited Scalability

    • Adding many devices can slow down the network and increase chances of collisions.

  2. Difficult Fault Detection

    • If a problem occurs, it's hard to identify the exact point of failure in the bus.

 16. Write a C program that uses structures to represent details of five books title, author, publisher and price) and prints them out.                                                                                       [8]

Ans:-
/*
Write a C program that uses structures to represent details of  five books title, author, publisher and price)  and prints them out. */
#include<stdio.h>
struct book
{
char b_title[100];
char b_author[100];
char b_publisher[100];
float b_price;
}a[5];
int main()
{
int i;
for(i=0;i<=4;i++)
{
printf("enter book title\n");
scanf("%s",&a[i].b_title);
printf("enter book author\n");
scanf("%s",&a[i].b_author);
printf("enter book publisher\n");
scanf("%s",&a[i].b_publisher);
printf("enter book price\n");
scanf("%f",&a[i].b_price);
}
printf("the records are:\n");
for(i=0;i<=4;i++)
{
printf("book title=%s\n",a[i].b_title);
printf("book author is=%s\n",a[i].b_author);
printf("book publisher is=%s\n",a[i].b_publisher);
printf("book price is=%f",a[i].b_price);
}
return 0;
}

OR

Discuss the concept of binary file handling in C programming and explain how putw() and getw() functions facilitate binary input/output operations. Give examples.                                                [8] 

    Ans:-                                                                        


Binary file handling:-
                               In C programming, binary file handling is the process of reading from or writing to files in binary mode. Unlike text files, binary files store data in the same format as in memory — not human-readable but more efficient for storing complex data structures.

Why Binary Files?

  • Faster access and processing.

  • Stores exact memory representation (good for structs).

  • Useful for multimedia, database, or large data applications

Example:
FILE *fp = fopen("student.dat", "wb");

In this example, the file 'stuent.data' stores data in binary format because we have used the mode 'wb'. Here 'b' stands for binary mode.


putw() and getw():

In C, putw() and getw() are simple functions used to write and read integers to/from a binary file. They are used for binary I/O and work directly with integer values.

Syntax:
int putw(int n, FILE *fp);   
int  variable=getw(FILE *fp);     

Example:-
#include<stdio.h>
int main()
{
FILE *k;
int number;
k= fopen("file.txt","wb+");
printf("enter number. To exit, press ctrl+z\n");
while(((scanf("%d",&number)))!=EOF)
{
putw(number,k);
}
rewind(k);
while((number=getw(k))!=EOF)
{
printf("%d\n",number);
}
printf("data read.");
fclose(k);
return 0;
}