Monday, April 14, 2025

[Solution]2081 (2024) Computer Science Supplementary Examination SET B

 

NEB - GRADE XII

2081 (2024)

Computer Science

Supplementary Examination

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.                                                     SET B                                                                        Full Marks: 50

 

Group ‘A’

Multiple choice questions                                                                     [9x1=9]  

1.       The statement in SQL which allows to change the definition of a table is:

a) Delete

b) Update

c) Create

d) Alter

2.       Which of the following key is considered unique in a table?

a) Candidate key

b) Primary key

c) Super key

d) Foreign key

3.       With SQL, how will you select records of those employees from a table named "staff" whose salary is less than 20000?

a) Select * from staff where salary is less than 20000;

b) Select * from staff where salary <20000;

c) Select * from staff where salary <= 20000;

d) Select * from staff where salary >20000;

4.       The full form of OSI is:

a) Operating System Interconnection

b) Operating System Information

c) Open System Interface

d) Open System Interconnection

5.       What type of language is PHP?
a) Client-side scripting
b) Server-side scripting
c) User-side scripting
d) Machine level

a) Client-side scripting

b) Server-side scripting

c) User-side scripting

d) Machine level

6.       Which JavaScript method is used to write HTML output?
a) console.log()
b) document.output()
c) document.write()
d) document.writeHTML()

a) console.log()

b) document.output()

c) document.write()

d) document.writeHTML()

7.       Which sign is used to declare variables in PHP?
a) @
b) *
c) ^
d) $

a) @

b) *

c) ^

d) $

8.       Which of the following is not an OOPs concept?

a) Inheritance

b) Polymorphism

c) Data Abstraction

d) Exception

9.       What is the primary goal of the system Testing phase in SDLC?

a) Creating system design

b) Gathering requirement

c) Identifying and fixing defects

d) Writing code

Group 'B'

Short answer questions                                                                             [5×5=25]

    1. List the different types of database models. Explain the Relational Database model in brief.
    2. OR
    3. Write any five differences between centralized and distributed database models.
    4. Write a program in JavaScript to find the largest number among three numbers.
    5. OR
    6. Write a PHP program to swap two numbers.
    7. How are programmers benefited from inheritance and polymorphism features of OOPs?

Ans:

Inheritance and polymorphism are two fundamental features of Object-Oriented Programming (OOP) that provide significant benefits to programmers. Here's how they help:

1. Inheritance (Code Reusability & Hierarchy):

Inheritance allows programmers to create new classes based on existing ones, reducing redundancy and improving maintainability. This provides several advantages:

a)       Code Reusability: Common functionalities are defined in a base class and reused in derived classes.

b)      Faster Development: New classes can inherit existing logic instead of writing from scratch.

c)       Scalability: Easy to extend existing code with additional features.

d)      Better Organization: Establishes a clear relationship between general and specific classes.

2. Polymorphism (Flexibility & Dynamic Behaviour):

Polymorphism enables objects to take multiple forms, allowing programmers to write more flexible and scalable code. This provides several advantages:

a)       Method Overriding: Subclasses can modify inherited methods for specific behaviour.

b)      Method Overloading: Allows multiple functions with the same name but different parameters, improving readability.

c)       Dynamic Binding (Runtime Polymorphism): Enables flexible and efficient function execution, supporting late binding.

d)      Simplifies Code Maintenance: Reduces complexity by allowing generic function calls.

 

    1. Explain the importance of the system analysis phase of SDLC.

Ans:

The System Analysis phase of the Software Development Life Cycle (SDLC) is crucial because it lays the foundation for a successful project by identifying business needs, defining requirements, and ensuring feasibility. Below are the key reasons why system analysis is important:

1)      Understanding Requirements: Gathers and defines functional and non-functional requirements to ensure stakeholder exjhmklimjkil,;za.,[‘pectations are clearly documented and aligned.

2)      Feasibility Study: Evaluates technical, economic, and operational feasibility to help decision-makers determine if the project should proceed.

3)      Identifying Problems and Solutions: Analyses the current system to identify inefficiencies and design solutions that effectively address user needs.

4)      Defining System Scope: Clearly outlines the system's boundaries to prevent scope creep and avoid delays or cost overruns.

5)      Reducing Risks: Identifies potential risks early and ensures compliance with legal, security, and performance standards.

6)      Facilitating Better System Design: Provides a clear roadmap for the design phase, enabling developers to build an efficient and scalable system.

 

    1. Define the terms Big Data and IoT (Internet of Things).

Ans:

Big Data is a term that describes extremely large and complex datasets that traditional data processing methods can't handle efficiently. It covers data that is characterized by high volume, high velocity, and high variety, often requiring advanced techniques and technologies to analyse and extract meaningful information. 

Examples of Big Data:

a)       Social media data (Facebook, Twitter, Instagram),

b)      E-commerce transactions (Amazon, Flipkart),

c)       Banking and financial transactions,

d)      IoT sensor data (smart cities, wearables),

e)      Search engine data (Google, Bing), etc.

 

The Internet of Things (IoT) refers to the network of physical devices, vehicles, appliances, and other physical objects that are embedded with sensors, software, and network connectivity, allowing them to collect and share data. These devices, often referred to as "smart objects," can range from simple everyday items like smart thermostats to complex industrial machinery.  

In simpler terms, it's about connecting everyday objects to the internet, allowing them to collect and share data. 

Applications of IoT are as follows:

a)       Smart Homes (e.g. smart thermostats, security cameras)

b)      Healthcare (e.g. wearable health monitors)

c)       Industrial IoT (IIoT) (e.g. predictive maintenance in factories)

d)      Agriculture (e.g. smart irrigation systems)

e)      Smart Cities (e.g. traffic management, waste monitoring)

 

 

Group 'C'

Long answer questions                                                                                               [2×8=16]

    1. Explain client-server and peer-to-peer network architecture with their diagrams. Write any two advantages and disadvantages of each.

Ans:

Networks can be broadly categorized into client-server and peer-to-peer (P2P) based on their architecture and how devices interact.

A client-server network is a type of network where one or more centralized computers (called servers) provide resources, services, or data to multiple other computers (called clients). The server manages and controls access to resources, while clients request and use those resources. Some examples are Web browsing, email, online banking, cloud storage, etc.

Advantages of client-server network architecture are as follows:

1)      Centralized Management: Easier to manage and secure data since everything is stored on the server.

2)      Scalability: Can handle a large number of clients by upgrading the server.

Disadvantages of peer-to-peer network architecture are as follows:

1)      Single Point of Failure: If the server goes down, the entire network is affected.

2)      Costly: Requires expensive hardware and maintenance for the server.


A peer-to-peer network is a decentralized network where all devices (called peers) are equal and can act as both clients and servers. Each device can share resources (like files or processing power) and access resources from other devices directly, without the need for a central server. Some examples are Torrenting, blockchain, P2P gaming, VoIP, etc.

Advantages of client-server network architecture are as follows:

1)      Cost-Effective: No need for a dedicated server, reducing costs.

2)      Decentralized: No single point of failure; if one peer goes down, others can still communicate.

Disadvantages of peer-to-peer network architecture are as follows:

1)      Less Secure: Harder to manage security since each device is independent.

2)      Limited Scalability: Not suitable for large networks as it becomes difficult to manage.

 

    1. Create a structure named "player" to store details pname, game, age, and salary. Write a C program to input details for five players and display their information in proper format.

Ans:

#include <stdio.h>

#include <conio.h>

struct player

{

    char pname[20], game[20];

    int age, salary;

};

void main()

{

    struct player p[5];

    int i;

    clrscr();

    for (i = 0; i < 5; i++)

    {

        printf("Enter Name: ");

        scanf("%s", p[i].pname);

        printf("Enter Game: ");

        scanf("%s", p[i].game);

        printf("Enter Age: ");

        scanf("%d", &p[i].age);

        printf("Enter Salary: ");

        scanf("%d", &p[i].salary);

    }  

    printf("\nNAME\tGAME\tAGE\tSALARY");

    for (i = 0; i < 5; i++)

    {

        printf("\n%s\t%s\t%d\t%d", p[i].pname, p[i].game, p[i].age, p[i].salary);

    }

    getch();

}

 

Example Output:

Enter Name: John

Enter Game: Cricket

Enter Age: 25

Enter Salary: 50000

………

Enter Name: David

Enter Game: Football

Enter Age: 24

Enter Salary: 55000

 

NAME    GAME          AGE     SALARY

John       Cricket         25        50000

……..

David     Football       24        55000


OR

Write a C program that illustrates the use of fprintf() and fscanf() functions of file handling.

Ans:

A C program that illustrates the use of fprintf() and fscanf() functions of file handling is as follows:

#include <stdio.h>

#include <conio.h>

void main()

{

    char name[20];

    int rn, age, i;

    FILE *fptr;

    clrscr();

    fptr = fopen("student.dat", "w");

    for (i = 1; i <= 10; i++)

    {

        printf("Enter name: ");

        scanf("%s", name);

        printf("Enter roll no: ");

        scanf("%d", &rn);

        printf("Enter age: ");

        scanf("%d", &age);

        fprintf(fptr, "\n%s\t%d\t%d", name, rn, age);

    }

    fclose(fptr);

 

    fptr = fopen("student.dat", "r");

    printf("\nNAME\tROLL NO\tAGE");

    while (fscanf(fptr, "%s %d %d", name, &rn, &age) != EOF)

    {

        printf("\n%s\t%d\t%d", name, rn, age);

    }

    fclose(fptr);

    getch();

}

 

Example Output:

Enter name: Madhav

Enter roll no: 101

Enter age: 20

Enter name: Susmita

Enter roll no: 102

Enter age: 18

........

Enter name: Suman

Enter roll no: 110

Enter age: 25

 

NAME    ROLL NO AGE

John    101     20

Alice   102     21

........

Leo     110     25

 

THE END

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home