-->

NEB year 2069 computer science questions and solutions

 NEB year 2069 computer science questions

New syllabus

HSEB-GRADE XII - 2069(2012)

Computer Science [230]

 

Time: 3 hrs                                                                                          Full  Marks : 75

                                                                                                            Pass Marks: 27

 

Group “A”

                                        Long Answer questions                                                  4x10=40

Attempts any Four  questions:

1.

What is looping? Describe “for” , “while” and “do-while” loops with appropriate examples.

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:-


While loop:-

Definition:-
It executes the program statements repeatedly until the given condition is true. It checks the condition at first; if it is found true then it executes the statements written in its body part otherwise it just gets out of the loop structure. It is also known as entry control or pre-test loop.Syntax of while Loop:

initialization;

while(condition)

{

statements;

increment/decrement;

}

Where initialization means starting point, control means stopping points and increment/decrement means counter.
Flowchart:-




Examaple:
#include<stdio.h>
int main()
{
int i=1;
while(i<=20)
{
printf("%d,",i);
i=i+1;
}
return 0;
}

Output:
If we execute this we will get 1,2,3....20

do..while loop:-

It also executes program statements repeatedly until the given condition is true. It executes the program statements once at first then only condition is checked. If a condition is found true then it executes the program statements again, otherwise it gets out from the loop structure. As it checks the condition at last it is also known as the post-test loop or exit control loop.
syntax:-
initialization;
do
{

statements;

increment/decrement;
}while(condition);
Flowchart:-


Example:
#include<stdio.h>
int main()
{
int i=1;
do
{
printf("%d,",i);
i=i+1;
}while(i<=20);
return 0;
}

Output:
If we execute this we will get 1,2,3....20
for loop:-

It is the most common type of loop which is used to execute a program statement or block of program statements repeatedly for a specified number of times. It is a definite loop. Mainly it consists of three expressions: initialization, condition and increment / decrement. The initialization defines the loop starting point, condition defines the loop stopping points and counter helps to increment and decrement the value of counter variable.


syntax:-
for(initialization;condition;increment/decrement )
{
statements;
}

Flowchart:-


For example:

#include<stdio.h>
int main()
{
int i;
for(i=1;i<=20;i++)
{
printf("%d,",i);
}
return 0;
}

Output:
If we execute this we will get 1,2,3....20

1+9

2.

What is control statement? Write a program which selects and prints largest among 3 numbers using “if-else” statement with flowcharts.

Ans:-

Control structure:-

When we write program and run on system, the execution occurs immediately. The execution of instruction sometimes has to be controlled by using many parts or blocks of statements to get desired output. This is called control structure. These are in built and very important part of programming field and programmers too. By using this we can glue the different parts like, “what a program is”, “what a program is going to do”, “what will happen if a particular condition satisfies and if does not satisfy” etc. this part is also called logic, Which is the heart of program, which makes the program sensible and meaningful. Mainly, we have three parts as a control structures or simply logics.

Second part:-

/*to pick greatest number among three numbers*/

#include <stdio.h> int main() { int a,b,c; printf("enter three number\n"); scanf("%d%d%d",&a,&b,&c); if(a>b && a>c) { printf("a=%d is the greatest",a); }

else if(b>a && b>c)

{ printf("b=%d is the greatest",b); } else { printf("c=%d is the greatest",c); } Flowchart:-

2+8

3.

What is string? Explain any four string handling functions with example.

Ans:-

String--
           It means series of characters used in our program. We can also use digits with characters. They also act as string or a part of it. It is used when we input our name or address or somewhere their combination.

Syntax
char identifier[value];
or char identifier[value][value];

We can use he upper one if we want to input single string then. And if we want to input multiple values then we use lower one(called 2-dimensional array in string).

For example,
char name[100];
gets(name)
Here, the variable accepts value having maximum characters 100. We can also write ,
char name[10]="kathmandu";
IT stores the value in following way.

It stores values from cell location '0' and ends at null character called escape sequence. This is used to show that there is no more character beyond that. This null character is used with strings only. For  numbers, it is not used.
                        Similarly, if we want to store multiple string with same name then one-dimensional is not applicable. We use two dimensional string.
We declare:

char name[5][50];
It means, we are going to store any five names having optimum 50 characters.
Let's look below. If we have five names :RAM,SHYAM,Nita then it would like

so sequentially it stores data in different row. We use loop to execute it with different data.
Or, instead of inputting string, if we initialize strings then it can be written as
  char name[5][50]={"RAM","Shyam","Nitu"};
second part:-

1) strlen(string);-It is used to get length of given string.

 syntax:
identifer=strlen(string);
For example,
#include<stdio.h>
#include<string.h>
void main()
{
char string[100]="apple";
int k;
k=strlen(string);
printf("length=%d",k);
}
It returns 5. It also counts white spaces present in a string.
If we want want , we can also input string using scanf() or gets().

2)strrev():- It reverses the string given by us.

syntax:- strrev(string);
example:

#include<stdio.h>
#include<string.h>
void main()
{
char string[100]="apple";
printf("reverseed string=%s",strrev(string));
}

We get output "elppa". Instead of putting in output line, we can put it before printf.

3)strlwr(): This function is used to convert given string into lower case.
syntax:-
strlwr(string);
Example;
#include<stdio.h>
#include<string.h>
void main()
{
char string[100]="APPLE";
printf("string in lowercase=%s",strlwr(string));
}

It gives us "apple" as an  output.

4)strupr():This string function is used to convert all characters of  string into upper case.

syntax:
strupr(string);

example:-
#include<stdio.h>
#include<string.h>
void main()
{
char string[100]="apple";
printf("string in uppercase=%s",strupr(string));
}

We get APPLE as an output after execution.

2+8

4.

Write a program to add two matrices by supplying elements of matrices by user.

Ans:-

/* to find sum of two 3x3 matrices*/

#include <stdio.h>


int main()

{

    int matrix1[3][3],matrix2[3][3];

    int i,j;

    printf("enter elements of matrix 1\n");

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

    {

        for(j=0;j<=2;j++)

        {

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

        }

    }

    printf("enter elements of matrix 2\n");

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

    {

        for(j=0;j<=2;j++)

        {

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

        }

    }

    printf("sum of two matrices is \n");

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

    {

        for(j=0;j<=2;j++)

        {

            printf(" %d ",matrix1[i][j]+matrix2[i][j]);

        }

        printf("\n");

    }

    return 0;

}



10

5.

Write a program which reads name, department and age from a file named “employee.dat” and display them in monitor.

Ans:-

#include<stdio.h>

int main()

{

 FILE *p;

char name[100];

char dept[100];

float age;

p=fopen("employee.dat","r");

while((fscanf(p,"%s %s %f",name,dept,&age))!=EOF)

{

 printf("name=%s,department=%s,age=%f\n",name,dept,age);

}

fclose(p);

return 0;

}


10

Group “B”

                                          Short Answer questions                                                 7x5=35

Attempts any Seven  questions:

6.

Explain different stages of system development life cycle with clear figure.

Ans:-

SDLC is a structure or a process to develop a software followed by a development team within the software organization. It consists of a detailed plan describing how to develop, maintain and replace specific software. SDLC is also known as information systems development or application development. It is life cycle defining a methodology for improving the quality of software and the overall development process. 



SDLC's different phases are shown around the circle.
1.Planning/requirements study
2.System ananlysis
3.System design
4.System Development 
5.System testing
6.System implementation
7.System evaluation
8System maintenance

Planning:-

The first step is problem definition(study). The intent is to identify the problem, determine its cause, and outline a strategy for solving it. It defines what ,when who and how project will be carried out. 

                    As we know everything starts with a concept. It could be a concept of someone, or everyone. However, there are those that do not start out with a concept but with a question, “What do you want?” and "really, is there a problem?" They ask thousands of people in a certain community or age group to know what they want and decide to create an answer. But it all goes back to planning and conceptualization. 

                                                In this phase the user identifies the need for a new or changes in old or an improved system in large organizations. This identification may be a part of system planning process. Information requirements of the organization as a whole are examined, and projects to meet these requirements are proactively identified. 

                                             We can apply techniques like:

1) Collecting data by about system by measuring things, counting things, survey or interview with workers, management, customers, and corporate partners to discover what these people know.

2) observing the processes in action to see where problems lie and improvements can be made in workflow.

3)Research similar systems elsewhere to see how similar problems have been addressed, test the existing system, study the workers in the organization and list the types of information the system needs to produce.

2) Getting the idea about context of problem

3) The processes - you need to know how data is transformed into information.

                     Like data structures, storage, constraints that must be put on the solution (e.g. operating system that is used, hardware power, minimum speed required etc,  what strategy will be best to manage the solution etc.    

5

7.

What are the types of LAN topologies? Explain with diagrams.

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.

Although we have many types of topology, here we are going to understand about two types.
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

5

8.

What is database? List the major uses of database application software.

Ans:-

Database:-

One way of classifying databases involves the type of content, for example: bibliographic, full-text, numeric, and image. Databases consist of software-based "containers" that are structured to collect and store information so users can retrieve, add, update or remove such information in an automatic fashion. Database programs are designed for users so that they can add or delete any information needed. The structure of a database is tabular, consisting of rows and columns of information.



Advantages
  • Reduced data redundancy
  • Improved data security
  • Reduced data entry, storage, and retrieval costs
  • Facilitated development of new applications program
  • improved data integrity (integrity:data should be accurate & accurate; it is done by providing some checks
  • multiple users.
  Disadvantages

  • Database systems are complex, difficult, and time-consuming to design
  • Substantial hardware and software start-up costs
  • Initial training required for all programmers and users
Major uses of database application softwares:-
1. provides an interface to the user as well as to application
2. lets user to create,maintain databases.
3. provides high integrity and security to its data.
4. provides sharing facility to many users.
5. provides relationships between tables.
6. provides access level to different users.
7. maintains integrity,consistency of data etces of database application softwares:-


Or

Differentiate between array and structure.

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;

1+4

 

 

9.

What is E-R diagram? Explain the advantages of E-R diagram in system design.

Ans:

E-R diagram:-

he Entity-Relationship (E-R) data model is based on a perception of a real world that consists of a collection of basic objects, called entities, and of relationships among these objects. An entity is a “thing” or “object” in the real world that is distinguishable from other objects. For example, each person is an entity, and bank accounts can be considered as entities.

Entities are described in a database by a set of attributes. For example, the attributes account-number and balance may describe one particular account in a bank, and they form attributes of the account entity set. Similarly, attributes customer-name, customer-street address and customer-city may describe a customer entity.

A relationship is an association among several entities. For example, a depositor relationship associates a customer with each account that she has. The set of all entities of the same type and the set of all relationships of the same type are termed an entity set and relationship set, respectively.

The overall logical structure (schema) of a database can be expressed graphically by an E-R diagram, which is built up from the following components:


Advantages:-

  • Exceptional conceptual simplicity.
  • Visual representation.
  • Effective communication tool.
  • Integrated with the relational database model.

1+4

10.

Explain the database model with suitable examples.

Ans:-

We hahve many database models like, hierarchical,network,relational,E-R model, etc.Here we are going to understand about two.
Relational model:-

Three key terms are used extensively in relational database models: relations, attributes, and domains. A relation is a table with columns and rows. The named columns of the relation are called attributes, and the domain is the set of values the attributes are allowed to take.

The basic data structure of the relational model is the table, where information about a particular entity is represented in columns and rows. Thus, the "relation" in "relational database" refers to the various tables in the database; a relation is a set of tuples.So,


Relational databases

  • Data is organized into two-dimensional tables, or relations

  • Each row is a tuple (record) and each column is an attribute (field)

  • A common field appears in more than one table and is used to establish relationships

  • Because of its power and flexibility, the relational database model is the predominant design approach


name

street

city

id no.

balance

RAm

Thapagaun

KTm

00321

Rs. 900087

ekan

BAneshwor

Pokhara

008

Rs.45666

Hary

Kalanki

Ktm

9870

Rs. 65799

Sam

Koteshwor

Ktm

7890

Rs. 5600

Kale

Kalnki

Ktm

456

Rs. 65400


In this table we have used different concept like field (each column),record (each row). Each row gives us a complete information. If we have many tables then we relate them for data extractions,this is called relationship between tables.Apart from these, we also use other concept like,primary key,foreign key,Entity etc.

E-R model(E-R diagram):        

The Entity-Relationship (E-R) data model is based on a perception of a real world that consists of a collection of basic objects, called entities, and of relationships among these objects. An entity is a “thing” or “object” in the real world that is distinguishable from other objects. For example, each person is an entity, and bank accounts can be considered as entities.

Entities are described in a database by a set of attributes. For example, the attributes account-number and balance may describe one particular account in a bank, and they form attributes of the account entity set. Similarly, attributes customer-name, customer-street address and customer-city may describe a customer entity.

A relationship is an association among several entities. For example, a depositor relationship associates a customer with each account that she has. The set of all entities of the same type and the set of all relationships of the same type are termed an entity set and relationship set, respectively.

The overall logical structure (schema) of a database can be expressed graphically by an E-R diagram, which is built up from the following components:

  • Rectangles, which represent entity sets

  • Ellipses, which represent attributes.

  • Diamonds, which represent relationships among entity sets.

  • Lines, which link attributes to entity sets and entity sets to relationships.

for example,

1)


5

11.

What are the key challenges of implementing e-governance in developing countries?

Ans:-

Electronic governance or e-governance is the application of information and communication technology (ICT) for delivering government services, exchange of information, communication transactions, integration of various stand-alone systems and services between government-to-customer (G2C), government-to-business (G2B), government-to-government (G2G) as well as back office processes and interactions within the entire government framework.

challenges of implementing e-governance:-

They are many challanges to implement e-governance in Nepal like countries beacuse of following reasons:

1.Lack of strategic plans

2 change management

3.budget constraint

4.weak infrastructure

5. literacy

6. lack of construction knowledge

7. lacks of leadership supports

8.security and privacy 

etc

Or

What is AI? Describe the application of AI.

Ans:-

AI:-
Artificial intelligence is where machines can learn and make decisions similarly to humans. There are many types of artificial intelligence including machine learning, where instead of being programmed what to think, machines can observe, analyse and learn from data and mistakes just like our human brains can. This technology is influencing consumer products and has led to significant breakthroughs in healthcare and physics as well as altered industries as diverse as manufacturing, finance and retail. In part due to the tremendous amount of data we generate every day and the computing power available, artificial intelligence has exploded in recent years. We might still be years away from generalised AI—when a machine can do anything a human brain can do—, but AI in its current form is still an essential part of our world.
Uses/aplication:-We can use AI in following fields.


game playing
You can buy machines that can play master level chess for a few hundred dollars. There is some AI in them, but they play well against people mainly through brute force computation--looking at hundreds of thousands of positions. To beat a world champion by brute force and known reliable heuristics requires being able to look at 200 million positions per second.
speech recognition
In the 1990s, computer speech recognition reached a practical level for limited purposes. Thus United Airlines has replaced its keyboard tree for flight information by a system using speech recognition of flight numbers and city names. It is quite convenient. On the the other hand, while it is possible to instruct some computers using speech, most users have gone back to the keyboard and the mouse as still more convenient.
understanding natural language
Just getting a sequence of words into a computer is not enough. Parsing sentences is not enough either. The computer has to be provided with an understanding of the domain the text is about, and this is presently possible only for very limited domains.
computer vision
The world is composed of three-dimensional objects, but the inputs to the human eye and computers' TV cameras are two dimensional. Some useful programs can work solely in two dimensions, but full computer vision requires partial three-dimensional information that is not just a set of two-dimensional views. At present there are only limited ways of representing three-dimensional information directly, and they are not as good as what humans evidently use

5

12.

What is multimedia? What are the components of multimedia? List out.

Ans:-

Multimedia:-
Multimedia is content that uses a combination of different content forms such as text, audio, images, animations, video and interactive content. Multimedia contrasts with media that use only rudimentary computer displays such as text-only or traditional forms of printed or hand-produced material.
Components:-

1)Text: Text is the most common medium of representing the information. In multimedia, text is mostly use for titles, headlines,menu etc. The most commonly used software for viewing text files are Microsoft Word, Notepad, Word pad etc. Mostly the text files are formatted with ,DOC, TXT etc extension.

2)Audio: In multimedia audio means related with recording, playing etc. Audio is an important components of multimedia because this component increase the understandability and improves the clarity of the concept. audio includes speech, music etc. The commonly used software for playing audio files are:
i) Quick Time
ii) Real player
iii) Windows Media Player

3)Graphics: Every multimedia presentation is based on graphics. The used of graphics in multimedia makes the concept more effective and presentable.the commonly used software for viewing graphics are windows Picture, Internet Explorer etc. The commonly used graphics editing software is Adobe Photoshop through which graphics can be edited easily and can be make effective and attractive.

4)Video: Video means moving pictures with sound. It is the best way to communicate with each other. In multimedia it is used to makes the information more presentable and it saves a large amount of time. The commonly used software for viewing videos are:
i) Quick Time
ii) Window Media Player
iii) Real Player

5)Animation: In computer animation is used to make changes to the images so that the sequence of the images appears to be moving pictures. An animated sequence shows a number of frames per second to produce an effect of motion in the user's eye.

1+4

13.

Define computer crime and its various forms.

Ans:-

Alternatively referred to as cyber crime, e-crime, electronic crime, or hi-tech crime. Computer crime is an act performed by a knowledgeable computer user, sometimes referred to as a hacker that illegally browses or steals a company's or individual's private information. In some cases, this person or group of individuals may be malicious and destroy or otherwise corrupt the computer or data files.


Below is a listing of the different types of computer crimes today. Clicking on any of the links below gives further information about each crime.
Child pornography - Making or distributing child pornography.
Cyber terrorism - Hacking, threats, and blackmailing towards a business or person.
Cyberbully or Cyberstalking - Harassing others online.
Creating Malware - Writing, creating, or distributing malware (e.g. viruses and spyware.)
Denial of Service attack - Overloading a system with so many requests it cannot serve normal requests.
Espionage - Spying on a person or business

5

14.

Write the advantages and disadvantages of OOP.

Ans:-

The major motivating factor in the invention of object oriented is to remove some of the flaws encountered in the procedural oriented approach. Object oriented programming uses concept of “Object” and treats data as a critical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the functions that operate on it, and protects it from accidental modifications from outside functions.
Some features are:-
1) Emphasis is on data rather than procedures or algorithms.
2) Programs are divided into what are known as objects.
3) Data structures are designed such that characterize the objects.
4) Functions that operate on the data are tied together in the data structure.

Advantages of OOP:-
  • Modularity for easier troubleshooting. Something has gone wrong, and you have no idea where to look. ...
  • Reuse of code through inheritance. ...
  • Flexibility through polymorphism. ...
  • Effective problem solving.
Dsiadvantages:
  • steep learning
  • more complex to create programs using some features polymorphism, inheritance etc
  • Large program size
  • slow execution etc

5

15.

Write short notes on :

a)    Coaxial cable                                 b) Satellite

Ans:-

a) coaxial cable:-

Coaxial cable, or coax,

  • 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.


2.5+2.5

No comments:

Post a Comment