-->

NEB year 2067 computer science questions and solutions

 NEB year 2067 computer science questions

old syllabus:

                                                                    GROUP-A (2x20=40)


Attempt any two questions.

q1)

        a)What is looping?Write a program to print first 10 terms of the following series using for loop.

            5,9,13....[2+3]

        Ans:-

    Loop:-

        It simply says execution of different statements/blocks again and again repeatedly under certain condition. When the condition dissatisfies, the execution stops. This is called iteration or looping.

        second part:-

        /* a program to print 5,9,13... 10th term*/

        #include<stdio.h>

        int maini()

        {

            int i,k=5;

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

            {

                printf("%d,",k);

                k=k+4;

            }

        return 0;

    }

        b)Write a recursive function to calculate the factorial of an integre number.[5]

        Ans:-

        /*recursive function to find factorial value*/

#include <stdio.h>

int fact(int);

int main()

{

    int number;

    printf("enter a number\n");

    scanf("%d",&number);

    printf("factorial value is=%d",fact(number));

    return 0;

}

int fact(int n)

{

    if(n<=0)

    return 1;

    else

    return n*fact(n-1);

}


        c)WRite a program to display all prime number from 1 to 100.

        Ans:-

#include <stdio.h>

int main()

{

    int i,j;

    int count=0;

    for(i=2;i<=100;i++)

    {

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

        {

            if(i%j==0)

            {

                count++;

            }

        }

        if(count==2)

        printf("%d,",i);

        count=0;

    }


    return 0;

}


        d)What do you mean by string manipulation?Explain about strcpy and strcat functions.[2+3]

    Ans:-

        String manipulation function:- 

Some library functions existing inside string.h which are used to process  string are called string 
manipulation functions.
For example,
We can use strlen() to find length of string.
second part:-
strcpy();- 
We use this function to copy one string to another. while copying, one replaces another.
Syntax:-
strcpy(string1,string2);
or strcpy(destination,source);

When we copy string, this is done from source to destination (string2 to string1). If first is empty then there would not be over-writing.

Example;
#include<stdio.h>
#include<string.h>
void main()
{
char string1[100]="APPLE";
char string2[100]="grapes";
printf("copied string =%s",strcpy(string1,string2));
}

output-
We get here string1=grapes. Because 'grapes' is copied to firs string named "APPLE". We can also write in reverse order.
strcat():-

The strcat() function is used to join or concatenate one string into another string.

Syntax:

strcat(strl,str2);

where str1,str2 are two strings. The content of string str2 is concatenated with string str1.

#include <stdio.h>

#include<string.h>

int main()

{

char str1[100],str2[100];

printf("Enter two strings = ");

scanf("%s%s",str1,str2);

strcat(str1,str2);

printf("After copying the string is %s ", str1);

return 0;

}

q2)

        a)How do you declare an array?Write a program to arrange the elements of an array in descending order.[3+7]

        Ans:-

        Array:-

        Definition: A composite variable capable of holding multiple data of same data type under a single variable name is called array.

Features:
->stores multiple values
->helps to solve complex porblem
->can be used as array as pointer
->pixel based graphics programming made easier etc

Declaration of Array:

datatype array_name [size];

Example: - int marks [10]; int x[4]={1,2,3,4};

Array size is fixed at the time of array declaration.

Generally, we use for loop () to assign data or item in memory and also use this loop to extract data from memory location.

Types of Array:

There are 2 types of array.

a) One Dimensional Array (1-D): IT is an array where we use one subscript value.It stores value in row in contigous cells.
syntax:
data type arra[value/size];
For example:
int a[10];
This array stores ten value starting from location zero na dends at 9.

b) Two Dimensional Array (2-D):an array where we may use two or more than two subscript values.
In this we use matrix concept.
syntax:
data type arra[row size][column size];
For example:
int a[2][2];
It uses two rows and two columns.
Values are stored as:

 

Column zero

Column one

Row 0 à

1(0,0)

2(0,1)

Row 1à

3(1,0)

4(1,1)

This array stores total four  values starting from location zero and ends at 1.

SEcond part:-

/* program to sort n elements in descending order and print them.


    */

#include <stdio.h>

int main()

{

int numbers[100];

int n,i,j,k;

printf("enter the size of n\n");

scanf("%d",&n);

printf("Enter numbers\n");

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

{

scanf("%d",&numbers[i]);

}

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

{

for(j=i+1;j<n;j++)

{

if(numbers[i]<numbers[j])

{

k=numbers[i];

numbers[i]=numbers[j];

numbers[j]=k;

}

}

}

printf("numbers in descending order are=:\n");

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

{

printf("%d\n",numbers[i]);

}

return 0;

}

        b)What are differences between library function and user defined functions?Write a program using user defined function to calculate y raise to power of x.[5+5]

    Ans:-

    Library function: 1.This is a function existing inside the library.

                                2.It can only be used.

                                3.Further modification is not allowed.

                                4.We need header file for this.

                            e.g. sqrt() or printf()

    User defined function:-1.This is a function created by user.

                                        2.It can  be used or created.

                                        3.We can modify ourselves.

                                        4.Header file is not needed.

                    e.g.

                                void sum()

        SEcond part:-

      //program to get y  raise to power x using user defined function.

#include<stdio.h>
#include<conio.h>
#include<math.h>
void powervalue();
void main()
{

powervalue();
getch();
}
void powervalue()
{
int x,y,output;
printf("enter base value\n");
scanf("%d",&x);
printf("enter power value\n");
scanf("%d",&y);
output=pow(x,y);
printf("the output =%d\n",output);
getch();
}

q3)

        a)Differentiate between array and structure with examples.[10]

    Ans:-

    Differences between array and struct are given below.                                                                                                                                                

Arraystruct
1.It stores same type of data1. It stores dis-similar type of data.
2.It uses static memory allocation .2.I uses dynamic memory allocation.
3.It takes less time to access elements.3.It takes more time to access elements.
4.It uses index value to access elements.4.It takes help of period operator(.) to access elements.
5.It is derived data type.5. IT is user's defined data type.
6.We can not define array of array.          6.We can define array of structure.
7.Its syntax is                                          
data type identifier[value];








example,int a[20];
7.Its syntax is
struct tag
{datatype member1;
datatype member2;
data type member3;
}variable;
example,
struct det
{char name[100];
char add[40];
int  roll;
}variable;

        b)Write a program to delete and rename the data file using remove() and rename() command.[10]

        Ans:-

    remove():this function is used to delete data file from the system.

syntax is:
remove("filename");

we have following example as a program.

//WAP to show use of command “remove” in data file handling with the help of example.
 #include<stdio.h>
#include<conio.h>
void main()
{
char choice;
printf("enter ur choice\n");
choice=getchar();
if(chice=='y')
        {
              remove("data.txt");
            printf("data file deleted sccessfully\n");
         }
else
{
printf("sorry, data filenot found\n");
}
getch();
}

rename(): it is used to rename the file.
syntax is
rename("old name","new name");
 example is given below.
//WAP to show use of command “rename” in data file handling with the help of example.
 #include<stdio.h>
#include<conio.h>
void main()
{
char choice;
printf("enter ur choice\n");
choice=getchar();
if(chice=='y')
        {
              rename("data.txt","data1.txt");
            printf("data file renaming done successfully\n");
         }
else
{
printf("sorry, data file could not be renamed\n");
}
getch();
}

        

                                                 GROUP-B (5x7=35)


Attempt any five questions.

q4)What is system ananlyst?Explain the roles of system analyst.[2+5]

Ans:-

System analyst:-
The persons who perform above task/system analysis,design and implementation activity is know as system analyst. Somewhere we say or call by names like business engineer, business analyst etc. The work of system analyst who designs an information system is just same as an architect of a house. They work as facilitators of the development of information systems and computer applications.
Roles:-

Defining Requirement: It's very difficult duty of analyst to understand user's problems as well as requirements. some techniques like interview, questioning, surveying, data collection etc have to be used. The basic step for any system analyst is to understand the requirements of the users.
Prioritizing Requirements: Number of users use the system in the organization. Each one has a different requirement and retrieves different information and in different time. For this the analyst must have good interpersonal skill, convincing power and knowledge about the requirements and setting them in proper order of all users.
Gathering Facts, data and opinions of Users: After determining the necessary needs and collecting useful information the analyst starts the development of the system with active cooperation from the users of the system. Time to time, the users update the analyst with the necessary information for developing the system. The analyst while developing the system continuously consults the users and acquires their views and opinions.
Evaluation and Analysis: Analyst analyses the working of the current information system in the organization and finds out extent to which they meet user's needs. on the basis of facts,opinions, analyst finds best characteristic of new system which will meet user's stated needs.
Solving Problems: Analyst is actually problem solver. An analyst must study the problem in depth and suggest alternate solutions to management. Problem solving approach usually has steps: identify the problem, analyse and understand the problem, identify alternate solutions and select best solution.

q5)What is feasibility study?Explain the different levels of feasibility study.[2+5]

Ans:-

feasibility study:-
 It is the measure and the study of how beneficial the development of the system would be to the organization. This is known as feasibility study. The aim of the feasibility study is to understand the problem and to determine whether it is worth proceeding.
It has following types.

1.Technical feasibility: - This is concerned with availability of hardware and software required for the development of system.The issues with can be like:
1.1) Is the proposed technology proven and practical?
1.2)the next question is: does the firm possess the necessary technology it needs. Here we have to ensure that the required technology is practical and available. Now, does it have required hardware and software?
1.3)The Last issue is related to availability of technical expertise. In this case, software and hardware are available but it may be difficult to find skilled manpower.
2.Operational feasibility:- It is all about problems that may arise during operations. There are two aspects related with this issue:
2.1) what is the probability that the solution developed may not be put to use or may not work?
                                   2.1) what is the inclination of management and end users towards solutions?
Besides these all some more issues;
                                                           a) Information: saying to provide adequate, timely, accurate and useful information to all categories of users.
                                                       b) Response time, it says about response about output in very fast time to users.
                                            c) Accuracy: A software system must operate accurately. It means, it should provide value to its users. It says degree of software performance.
           d) Services:- The system should be able to provide reliable services.
             e)Security:- there should be adequate security to information and data from frauds.
f) Efficiency: The system needs to be able to provide desirable services to users.
3) Economic feasibility: - It is the measure of cost effectiveness of the project. The economic feasibility is nothing but judging whether the possible benefit of solving the problem is worthwhile or not. Under "cost benefit analysis", there are mainly two types of costs namely, cost of human resources and cost of training.
                                                             The first one says about salaries of system analysts, software engineers, programmers, data entry operators etc. whereas 2nd one says about training to be given to new staffs about how to operate a newly arrived system.

4) Legal feasibility: - It is the study about issues arising out the need to the development of the system. The possible consideration might include copyright law, labor law, antitrust legislation, foreign trade etc.
Apart from these all we have some more types:
behaviour feasibility, schedule feasibility study etc.

q6)What is network topology?Explain different types of topology with diagrams.[7]

Ans:-

Network topology:
Network topology is the arrangement of the elements of a communication network. Network topology can be used to define or describe the arrangement of various types of telecommunication networks, including command and control radio networks, industrial fieldbusses and computer networks.

  As we know there are many types topologies. 

1.Bus topology
2.Star topology
3.Mesh topology
4.Ring topology
5.Star-ring topology
6.Tree topology
etc
Here we are going to understand about two.

star topology:

A star topology is designed with each node (file server, workstations, and peripherals) connected directly to a central network hub, switch, or concentrator (See fig. 2).
Data on a star network passes through the hub, switch, or concentrator before continuing to its destination. The hub, switch, or concentrator manages and controls all functions of the network.
 It also acts as a repeater for the data flow. This configuration is common with twisted pair cable; however, it can also be used with coaxial cable or fiber optic cable.



                Fig. 2. Star topology

Advantages of a Star Topology

  • Easy to install and wire.

  • No disruptions to the network when connecting or removing devices.

  • Easy to detect faults and to remove parts.

Disadvantages of a Star Topology

  • Requires more cable length than a linear topology.

  • If the hub, switch, or concentrator fails, nodes attached are disabled.


Ring topology:
A ring network is a network topology in which each node connects to exactly two other nodes, forming a single continuous pathway for signals through each node – a ring. Data travels from node to node, with each node along the way handling every packet.


Advantages of Ring topology:

  • Reduced chances of data collision as each node release a data packet after receiving the token.
  • Token passing makes ring topology perform better than bus topology under heavy traffic.
  • No need of server to control connectivity among the nodes.10. Describe the wireless network system. List out deices and equipment necessary for Wi-Fi network. 3+2
disadvantages:-
1.It is difficult to find the problem.
2.To add extra noe or computer, we have to di-assemble entire networks.
3.It is expensive

4.Shutting down of one node leads entire networking to be down  

3.Bus topology:

A linear bus topology consists of a main run of cable with a terminator at each end (See fig. 1). All nodes (file server, workstations, and peripherals) are connected to the linear cable.


Fig. 1. Linear Bus topology

Advantages of a Linear Bus Topology

  • Installation is easy and cheap to connect a computer or peripheral to a linear bus.

  • Requires less cable length than a star topology.

Disadvantages of a Linear Bus Topology

  • Entire network shuts down if there is a break in the main cable.

  • Difficult to identify the problem if the entire network shuts down.

  • Not meant to be used as a stand-alone solution in a large building.


q7)Write short notes on:

    a)Data security

    Ans:-

     It simply says protection of data /information contained in database against unauthorized access, modification or destruction. The main condition for database security is to have “database integrity’ which says about mechanism to keep data in consistent form. Besides these all, we can apply different level of securities like:

    1. Physical: - It says about sites where data is stored must be physically secured.
    2. Human: - It is an authorization is given to user to reduce chance of any information leakage or manipulation.
    3. Operating system: We must take a foolproof operating system regarding security such that no weakness in o.s.
    4. Network: - since database is shared in network so the software level security for database must be maintained.
    5. Database system: - the data in database needs final level of access control i.e. a user only should be allowed to read and issue queries but not should be allowed to modify data

    b)E-commerce

    Ans:-

E-commerce is a transaction of buying or selling online. Electronic commerce draws on technologies such as mobile commerceelectronic funds transfersupply chain managementInternet marketingonline transaction processingelectronic data interchange (EDI), inventory management systems, and automated data collection systems. Modern electronic commerce typically uses the World Wide Web for at least one part of the transaction's life cycle although it may also use other technologies such as e-mail.
E-commerce businesses may employ some or all of the following:

  • Online shopping web sites for retail sales direct to consumers
  • Providing or participating in online marketplaces, which process third-party business-to-consumer or consumer-to-consumer sales
  • Business-to-business buying and selling
  • Gathering and using demographic data through web contacts and social media
  • Business-to-business (B2B) electronic data interchange
  • Marketing to prospective and established customers by e-mail or fax (for example, with newsletters)
  • Engaging in pretail for launching new products and services

q8)What is normalization?Explain normalization process with examples.[2+5]

Ans:-

In the field of relational database design, normalization is a systematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain undesirable characteristics—insertion, update, and deletion anomalies that could lead to a loss of integrity.
It is of following types:
1N
2N
3N
4N

and 5N
Advantages:-

Some of the major benefits include the following :

  • Greater overall database organization
  • Reduction of redundant data
  • Data consistency within the database
  • A much more flexible database design
  • A better handle on database security
  • Fewer indexes per table ensures faster maintenance tasks (index rebuilds).

  • Also realizes the option of joining only the tables that are needed.
Let's understand about 1N and 2N:
1N:-

1 NF:

        

A TABLE IS SAID TO BE IN 1n IF there is not repeating groups or information in a table..Here, repeating group means a set of columns that stores similar information that repeats in the same table.

Let’s consider following SQL commands.

Create table contacts

(

Contact Id               Integer                    not null,

L_name                  varchar(20)            not null,

F_name                  varchar(20)           

Contact_date1      date,

Contact_desc1      varchar(50),

Contact_date2      date,

Contact_desc2      varchar(50),

);

We can see here in this table that there is a repeating group of date and description.

Now to convert into 1 N, we have to make a new table and shift that repeating group into new table.

Like,

Create table contacts

(

Contact_ID integer        not null,

L_name      varchar(20) not null,

F_name      varchar(20)

);

 

Create table conversation

(

Contact_id integer        not null,

Contact_date date,

Contact_desc        varchar(50)

);


2N:

A table is said to be in 2 N if it is in 1N and there is no redundant data in table i.e. if a value of column is dependent on one column(primary key only) but not another.

For example:

Create table employee

(

Emp_no     integer        not null,

L-name       varchar(20) not null,

F_name      varchar(20),

Dept_code integer,

Description varchar(50),

);

This table contains redundant data i.e. the value of column(field) “description” depends on dept_code but does not depend on primary key “emp_no”.So let’s make a new table and shift them into that.

Create table employee

(

Emp_no     integer        not null,

L_name      varchar(20) not null,

F_name      varchar(20),

Dept_code integer,

);

 

Create table department

(

Dept_code integer        not null,

Description varchar(50) not null,

);

We got two tables named employee and department with fields. Both the tables are related by primary key called dept_code. Now there is no redundancy and table is in 2N.

q9)Explain terms terms polymorphism and inheritance.[2+5]

Ans:-

polymorphism :-
Its an important OOPs concept , Polymorphism means taking more than one forms .Polymorphism gives us the ultimate flexibility in extensibility. The ability to define more than one function with the same name is called Polymorphism.Polymorphism allows the programmer to treat derived class members just like their parent class’s members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to calls of methods of the same name .If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). Each subclass overrides the speak() method inherited from the parent class Animal.
example is:
Simple example of Polymorphism, look at an Account (it may be checking or saving assuming each attract different dividends) you walk in a bank and ask a teller what is my balance? or dividends? you don't need to specify what kind of an account you're having he will internally figure out looking at his books and provide you the details.

Inheritance
Inheritance is mainly used for code reusability.In the real world there are many objects that can be specialized. In OOP, a parent class can inherit its behavior and state to children classes. Inheritance means using the Predefined Code. This is very main feature of OOP, with the advantage of Inheritance we can use any code that is previously created. This concept was developed to manage generalization and specialization in OOP.  Lets say we have a class called Car and Racing Car . Then the attributes like engine no. , color of the Class car can be inherited by the class Racing Car . The class Car will be Parent class , and the class Racing Car will be the derived class or child class
The following OO terms are commonly used names given to parent and child classes in OOP:
Superclass: Parent class.
Subclass: Child class.
Base class: Parent class.
Derived class: Child class
It can have many types.
single inheritance:-one derived class inherits property from one base class
multiple              “  :- one derived class inherits property from many base classes.
multi level          “ :-in this many derived classes are inherited from many base classes
hierarchical       “ :-under this many derived classes can be inherited from single base class
hybrid                 “:-it’s a combination of hierarchical and multilevel.

q10)What is Internet?What is the use of Internet in business?[2+5]

Ans:-

Internet is a web of networks i.e. interconnection of large number of computers throughout the world. The computers are connected (wired or wireless via satellite) in such a way that anybody from anywhere can access anything/ information. It is the largest network in the world just like a communication service provided by different companies.

Internet in business:-

Internet helps us to control everything related to online  transactions, statements,bill payments etc.Not only thtat much it is also being used to book a ticket for bus or plane or may be taxi.Now-a-days, we can call a taxi at our doorstep using mobile apps.No bargaining is needed. That app calcualtes the total fair.In Nepal, some pouplar e-coomerce sites like daraz.com.np, sastodeal.com,okdam etc are successfully running and providing better service to its customers. We do not need to go anywhere. just need an app and control everything.

this was about only national level of marketting.If we want to to marketing internationally then this is the best option.We can easily promote our business or product all over the world and can reach millions of customers,That is called B2B business.It also includes B2C.

q11)What do you understand by the term "data integrity"?Why is it important thing to be considered while designing a database?Explain.[2+5]

Ans:-

Data integrity: 

                   Integrity is consistency of actions, values, methods, measures, principles, expectations and outcome. 

Data integrity is a term used in computer science and telecommunications that can mean ensuring data is "whole" or complete, the condition in which data are identically maintained during any operation (such as transfer, storage or retrieval), the preservation of data for their intended use, or, relative to specified operations, the a priori expectation of data quality. 

                    


Entity integrity concerns the concept of a primary key. Entity integrity is an integrity rule which states that every table must have a primary key and that the column or columns chosen to be the primary key should be unique and not null. It means the primary key’s data must not be missing in table/s.

  


Referential Integrity

Referential integrity ensures that the relationship between the primary key (in a referenced table) and the foreign key (in each of the referencing tables) is always maintained. The maintenance of this relationship means that:

  • A row in a referenced table cannot be deleted, nor can the primary key be changed, if a foreign key refers to the row. For example, you cannot delete a customer that has placed one or more orders.

  • A row cannot be added to a referencing table if the foreign key does not match the primary key of an existing row in the referenced table. For example, you cannot create an order for a customer that does not exist.


Domain Integrity

Domain (or column) integrity specifies the set of data values that are valid for a column and determines whether null values are allowed. Domain integrity is enforced by validity checking and by restricting the data type, format, or range of possible values allowed in a column.

Importance:-

This integrity concept is used to handle/manage:

1.reduce redundancy

2.Maintain consistency

3.To handle simple as well as complex query

4.to link tables

5.to avoid wrong or invalid entry of data.

etc.

q12)Write short notes on:

    a)Co-axial cable

Ans:-

coaxial cable:-
  • It is an electrical cable with an inner conductor surrounded by a flexible, tubular insulating layer, surrounded by a tubular conducting shield.
  • The term coaxial comes from the inner conductor and the outer shield sharing the same geometric axis.
  • Coaxial cable is used as a transmission line for radio frequency signals, in applications such as connecting radio transmitters and receivers with their antennas, computer network (Internet) connections, and distributing cable television signals and uses many connectors.
  • It is available in two types thin (10base2; means 100 MBPS and upto 200 meter) and thick (10base5 coax;means 10 MBPS, and upto 5oo meter). They are different in diameter and bandwidth. Most of television operators use this. They are obsolete and no longer in use for computer networking

figure :coaxial cable

    b)Satellite:-

In the context of spaceflight, a satellite is an object which has been placed into orbit by human endeavor. Such objects are sometimes called artificial satellites to distinguish them from natural satellites such as the Moon.
Satellites are usually semi-independent computer-controlled systems. Satellite subsystems attend many tasks, such as power generation, thermal control, telemetry, altitude control and orbit control
satellite has on board computer to control and monitor system.
Additionally, it has radio antennae (receiver and transmitter) with which it can communicate with ground crew.Most of the satellites have attitude control system(ACS).It keeps the satellite in right direction.
Common types include military and civilian Earth observation satellites, communications satellites, navigation satellites, weather satellites, and research satellites. Space stations and human spacecraft in orbit are also satellites.
Satellite orbits vary greatly, depending on the purpose of the satellite, and are classified in a number of ways. Well-known (overlapping) classes include low Earth orbit, polar orbit, and geostationary orbit.

No comments:

Post a Comment