NEB year 2066 computer science questions and solutions

 NEB year 2066 computer science questions

old syllabus:


                                                                            Group-A (2x20=40)

Attempt any two questions.


      a)Write an algorithm  for a program that input cost of price (CP) an dselling price (SP) and determeine whether there is gain or loss.Convert this algorithm into program code.[5];



        Step1: Start

        Step 2: Input sp and cp

        Step 3: Check, is sp greater than cp?

                3.1 If yes, calculate gain=sp-cp and display gain.goto last step

                3.2 If no, calculate loss=cp-sp and display loss. goto last step

        Step 4: Stop

    C'' code:-
        #include <stdio.h>

        int main()


            float sp,cp,gain,loss;

            printf("Enter selling price and cost price : ");





            printf("Gain = NPR. %0.2f",gain);





        printf("Loss = NPR. %0.2f",loss);


        return 0;


    b)Write a program to display the name of day on the basis of  entered number 1 to 7.For example ,1 for Sunday.[5]


    /*WAP to display the name of day on the basis of entered number 1 to 7 using switch.

 For example, 1 for  Sunday.*/

void main()
int choice;
int number,output;
printf("'we have following menu\n");
printf( "1.for Sunday\n");
printf("2. for Monday\n");
printf("3 for Tuesday\n");
printf("4 for Wednesday\n");
printf("5 for Thrusday\n");
printf("6 for Friday\n");
printf("7 for Saturday\n");
printf("enter your choice 1 or 2 or 3 or 4 or 5 or 6 or 7 or any other number to exit\n");
                  case 1:
                            printf("It's Sunday\n");
               case 2:
                            printf("It's Monday\n");

               case 3:
                           printf("IT's Tuesday\n");                            
             case 4:
                       printf("It's Wednesday\n");
          case 5:
                      printf("It's Thrusday\n");
           case 6:
                     printf("It's Friday\n");
            case 7:
                        printf("It's Saturday\n");
                            printf("sorry, not a valid input\n");
                            printf("thank u, terminating....\n");

    c)Write a program to input an integer number and check whether it is prime or not.[5]


#include <stdio.h>

int main()


    int i,n;

    printf("entera number\n");


    int count=0;









        printf("%d is prime,",n);


        printf("%d is composite,",n);

    return 0;


    d)Explain data types used in C programming language with example.[5]


    C language provides us the way to hold any type of data in it. It is called data type. In C language data types classified into two categories:-

1.Primary data type
2.secondary data type
Major data types  used in C:-Mostly we use primary data types.they are

Integers:- An integer can be a whole number but not a fractional number. It can accept any + ve or –ve number.  It is very common type of data used by computer. When we add/subtract/divide/multiply, we get integer but if output is in fractional, the system just truncates that decimal part and returns only integer part. Like 1+2 yields 3. 3 divided by 2 yields 1. For this data type in some language, we use some suffix like % or word like ‘int’.


Floating part:- If we are going to write a program which includes some like fraction type of data then we use this data type. Like, 1.23, -.34.45 etc. the computers recognize the real numbers having fractions easily and processes accordingly. For float type of data, we use some words like ‘float’ and some where suffix like ! or #.



Character type:- Simply a letter or a number or space or any other symbol which we use in program is called character. A single character is placed in a single quote like ‘a’ or ‘,’ or ‘1’ etc. but, if we combine many characters then we put inside double quote like “computer”, it has 8 characters. For this type, we use reserved word like ‘char’ in C and some where it is not needed.


                       String type: A data type which contains many characters together and mostly put inside double quote (in most language) is called string. Like “computing” or “education” etc. for this, we use reserved word char with some index value. In C, we can write char name[20];. Here name is a string type of data and holds up to 20 characters.

This data type is used for exponential values and for more accuracy of digits.It's working range is more than others. so if we want to use long numbers of any type and high accuracy then...? for example,
   data type variable;
double ab;
'ab' is a variable of double type. It can store exponential values (3x104). It ca n be written as 3e+4 or 3E+4. If power is in negative form then it can be in 3e-4 or 3E-4. It has one advantage over others that it can be used in place of others easily.


    a)Write a program to store name and marks of 20 students.Sort the data according with marks in descending order and display that.[10]



C program to input name  and marks of 20 students and arrange
them in ascending order to the marks.
#include <stdio.h>
struct shorting
  char name[100];
   int marks;
int main()
    int i,j;
    printf("enter name and marks\n");
        printf("name=%s marks=%d\n",var[i].name,var[i].marks);
    return 0;

    b)Write a program to find the sum of 'n' integer number using function.[10]


    //program to get sum of 'n' integers using function.

        void sum();
        void main()

    void sum()
        int k=1,n,sum=0;
        printf("enter value of 'n'\n");


    a)Write a program to store stdno,name and marks or n students in a data file.Display the records in appropriate format reading from the fiel.[10]



int main()


 FILE *p;

char name[100];

int stdno;

int eng,phy,maths,chem,csc;


printf("enter name,student no.and marks in eng,phy,maths,chem and csc\n");

printf("To exit ,press ctrl+z\n");







printf("data are\n");



 printf("name=%s,stdno=%d, english=%d,physics=%d,maths=%d,chemistry=%d ,csc=%d \n",name,stdno,eng,phy,maths,chem,csc);



return 0;


    b)Differentiate array and structure with examples.[10]


    Differences between array and struct are given below.                                                                                                                                                

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;
struct det
{char name[100];
char add[40];
int  roll;

                                                             Group-A (5x7=35)

Attempt any five questions.

4. Define Network Architecture. Explain client-server and peer-to-peer networking. [2+5]


Network Architecture:-

Network architecture refers to the way network devices and services are structured to serve the connectivity needs of client devices. Network devices typically include switches and routers. Types of services include DHCP and DNS. Client devices comprise end-user devices, servers, and. smart things.

             Client –server:
  • In this, one or two computers work as server and left all work as clients.

  • Clients computers give request to server for a task to be performed.

  • Clients computers may or may not have self processing capability. they rely on server.

  • Mostly servers use a powerful operating system like, Linux or Unix or Win advanced server2008 etc.

  • Through server, the sharing of files is done.

  • Everything is controlled by server so in the case of down, services can not be completed.

  • under heavy load, many servers share the tasks.

  • there is high level security in networking.

  • High traffic towards servers while processing.

       Peer to peer(P2P):
  • In this all the computers are treated equally.

  • No one computer is server or client.

  • All computers can be said working as client or server.

  • Computers have self processing capability and do not rely on others.

  • Computers have or can run with normal operating system like, XP, Me etc and application.

  • Easy sharing of files and allows us to have chatting.

  • failure of one does not mean others are down; networking goes on.

  • If heavy load is given, they may not give same performance. etc

  • low level security.

5. Explain about the system designing methodologies. [7]


Basically we have two design methodologies.

1.Top-down methodology

2. Bottom-up methodologies

Let's know about them:

1.Top-down methodology :-

            This methodology carries following properties.

  1. Breaks the massive problem into smaller subproblems.
  2. Submodules are solitarily analysed
  3. communication is not required in the top-down approach.
  4. Contain redundant information.
  5. Structure/procedural oriented programming languages (i.e. C) follows the top-down approach.
  6. It is mainly used in Module documentation, test case creation, code implementation and debugging.
2. Bottom-up methodologies:-
  1. Solves the fundamental low-level problem and integrates them into a larger one.
  2. Examine what data is to be encapsulated, and implies the concept of information hiding.
  3. Needs a specific amount of communication.
  4. Redundancy can be eliminated.
  5. Object-oriented programming languages (like C++, Java, etc.) follows the bottom-up approach.
  6. It is used mainly intesting.

6. Explain about OSI/ISO model of networking,[7]


OSI model:-

The OSI, or Open System Interconnection, model defines a networking framework for implementing protocols in seven layers. Control is passed from one layer to the next, starting at the application layer in one station, and proceeding to the bottom layer, over the channel to the next station and back up the hierarchy.

---------------------->Application (Layer 7)

  • This layer supports application and end-user processes. 

  • Communication partners are identified, quality of service is identified, user authentication and privacy are considered, and any constraints on data syntax are identified. 

----------------------->Presentation layer (layer 6):-

  • This layer provides independence from differences in data representation (encryption) by translating from application to network format, and vice versa. 

  • The presentation layer works to transform data into the form that the application layer can accept.

------------------------>Session (Layer 5)

  • This layer establishes, manages and terminates connections between applications.

----------------------->Transport (Layer 4)

  • This layer provides transparent transfer of data between end systems, or hosts, and is responsible for end-to-end error recovery and flow control.

  •  It ensures complete data transfer.

------------------------->Network (Layer 3)

  • This layer provides switching and routing technologies, creating logical paths, known as virtual circuits, for transmitting data from node to node

------------------------>Data Link (Layer 2)

  • At this layer, data packets are encoded and decoded into bits.

  •  It furnishes transmission protocol knowledge and management and handles errors in the physical layer, flow control and frame synchronization

------------------------->Physical (Layer 1)

  • This layer conveys the bit stream - electrical impulse, light or radio signal -- through the network at the electrical and mechanical level. 

  • It provides the hardware means of sending and receiving data on a carrier, including defining cables, cards and physical aspects

7. Define database and DBMS. Explain the advantage of Database system over flat-file system. [2+5]



Simply well organized collection of data is 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.


  • Reduced data redundancy

  • Improved data security

  • Reduced data entry, storage, and retrieval costs

  • Facilitated development of new applications program


 A DBMS is a system software package that helps the use of integrated collection of data records and files known as databases. It allows different user application programs to easily access the same database. DBMSs may use any of a variety of database models, such as the network model or relational model. In large systems, a DBMS allows users and other software to store and retrieve data in a structured way. Instead of having to write computer programs to extract information, user can ask simple questions in a query language. 

              Its roles can be listed as given below.

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.

Second part:-

Advantages of DBMS over flat file system:-

It used to have following advantage over flat file approach:-

1) Data redundancy

2) Data integrity

3) Data consistency

4) Security, sharings

5) Isolation of data.


8. Explain about the importance of computer security in this knowledge based society. [7]


Computer security goes hand-in-hand with data security. System security describes the controls and safeguards that an organization takes to ensure its networks and resources are safe from downtime, interference or malicious intrusion.
Some common cyber attacks done to harm our server/computers:

2.Denial of Service
3.Backdoor attack
4.Direct Access Attack
6.Salami saving
To be safe from these types of attacks, we can use following methods.
1.Using antivirus software
2.Using genuine software
3.Downloading files/softwares from secured sites.
4.Using powerful OS.
5.Enabling our firewall.
6.By noticing symptoms of computer.
7.By putting secured password and not shring withanyone.

9. What are the different program logic tools? Explain about the decision table and decision tree with examples.[2+5]


Different program logic tools are given below.




4.Decision table

5.Decision tree



Let's understand about decision table and decision tree.

Decision table:- A decision table is a table with various conditions and their corresponding actions. Decision table is a two dimensional matrix. It is divided into four parts, condition stub, action stub, condition entry, and action entry. See the first figure listed below. Condition stub shows the various possible conditions. Condition entry is used for specifying which condition is being analyzed. Action stub shows the various actions taken against different conditions.

And action entry is used to find out which action is taken corresponding to a particular set of conditions.

condition stub                                               condition entry









Is a person SLC pass ?









Is a person with percentage>=60









Is a person with entrance marks>=40









admit him




no, do not admit him




can be but under re-entrance





action stub action entry

Decision tree is a set of rules for what to do in certain condition and if particular condition  

satisfies, do that otherwise go to this step. They can be used to enforce strict compliance with local procedures, and avoid improper behaviors, especially in complex procedures or life-and-death situations.

E.g. If the photocopier breaks down, call Raj. If Raj is not available, call Aasha. If Aasha is away, ring Sary.

They are valuable when setting out how the system should behave, and what conditions it will need to be able to cope with. A decision tree showing decisions and actions required of a software system

In above diagram we can see how an applicant is selected or hired under different condition.Sometimes in critical situation it can be used for decision taking. 

10. What are the advantages of distributed database system over centralized database system? [7]


Distributed database system:-

A distributed database is basically a database that is not limited to one system, it is spread over different sites, i.e, on multiple computers or over a network of computers. A distributed database system is located on various sites that don’t share physical components. This may be required when a particular database needs to be accessed by various users globally. It needs to be managed such that for the users it looks like one single database.


Following are some advantages over centralized daatbase.

1.It is highly secured.

2.If  a computer fails, entire system keeps on runnig.

3.There is load balancing.

4.High performance.

5.Faster response time.

6.Fast data sharing.


11. Explain about the different testing techniques during the system development [7]


System Testing Methodologies:
1.Functional   Testing:Functional testing involves testing the application against the business requirements. It incorporates all test types designed to guarantee each part of a piece of software behaves as expected by using uses cases provided by the design team or business analyst. We perform following testing under this.
  • Unit Testing. 
Unit testing is the first level of testing and is often performed by the developers themselves.
  • Integration Testing:-
After each unit is thoroughly tested, it is integrated with other units to create modules or components that are designed to perform specific tasks or activities.
  • System Testing:-
System testing is a black box testing method used to evaluate the completed and integrated system, as a whole, to ensure it meets specified requirements.
  • Acceptance Testing:
Acceptance testing is the last phase of functional testing and is used to assess whether or not the final piece of software is ready for delivery

2. Non-functional Testing:- It incorporates all test types focused on the operational aspects of a piece of software. These include:
  • Performance Testing:-
                              Performance testing is a non-functional testing technique used to determine how an application will behave under various conditions.      
  • Security Testing
                        Security testing is a non-functional software testing technique used to determine if the information and data in a system is protected. 
  • Usability Testing
                    Usability testing is a testing method that measures an application’s ease-of-use from the end-user perspective and is often performed during the system or acceptance testing stages.

12. Write short notes: [3.5+3.5)

a)E-commerce b) Inheritance



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


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.




1 comment:

  1. Top 10 casino games from RealTime Gaming
    The first 온 카지노 time หาเงินออนไลน์ you're playing the casino game online in your browser doesn't feel 더킹 카지노 like 먹튀 커뮤니티 you have logged in to 온라인 카지노 먹튀 play it. The casino games are designed to