-->

NEB year 2065 computer science questions and solutions

 NEB year 2065 computer science questions

old syllabus:

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

                                                                                    Group 'A' (Long Answer Questions)

Attempt any two of the following questions:[2x20 = 40]

1.     a) Write an algorithm and a flowchart for a program that checks whether the number entered by user is exactly divisible by 5 but not by 11.[5]

        Ans:-

        Algorithm:-

        1.start

        2.Input a number as 'n'

        3.Let, rem1=remainder of n/5

        4.Let, rem2=remainder of n/11

        5. IF rem1=0 and rem2 not equal to 0

                5.1 print "it is divisible by 5 and not by 11"

                5.2 goto last step

            else

               5.11 print "it is divisible by 5 and by 11"

                5.21 goto last step

        6.stop

    Flowchart:-

    



         b) Write a program that reads three numbers and display the largest among them. [5]

        Ans:-    

        // program to get greatest number among three numbers

        #include<stdio.h>
        #include<conio.h>
        void main()
        {
            float a,b,c;
            printf(“enter three numbers\n”);
            scanf(“%f%f%f”,&a,&b,&c);
            if(a>b &&a>c)
                {
                printf(“the greatest number=%f\n”,a);
                }
            elseif(b>a &&b>c)
            {
            printf(“the greatest number=%f\n”,b);
            }
        else
        {
        printf(“the greatest number=%f\n”,c);
        }
        getch();
    }

        c) What is an operator? Explain different types of operators used in programming[2+3]

        Ans:-

        
operator:-

operator:- It is a symbol or a character used in programming. It is used to carry out some operation.
for example: +,-,= etc
Types of operator:-Although it is of different types, here  we are going to understand about two.
It is of following types.
1)Arithmetic operator: It is used to do arithmetic calculations/operation.
 It has following types.

 +         -----------> used for addition.example is a+b. It means we are performing addition with the help of operand a and b
-           ------------>It is used for subtraction.Example is a-b.  It means we are performing subtraction with the help of operand a and b
* -------------------->used for multiplication.example is a*b. It means we are performing multiplication with the help of operand a and b
/---------------->used for division.example is a/b. It means we are performing division with the help of operand a and b
%---------------->used for remainder division.example is a%b. It means we are performing division with the help of operand a and b.It gives us remainder after division.

2)relational operator: 
This operator is used to perform comparisons between variables.It supports us to take decision logically. example,x>y ,x>=y etc
Relational operator has following types.


>------> It is used to show greater than. like x>y
>=----->It is used to show greater than or equals to.like x>=y
<-------->It is used to show a variable is smaller than another.like x<y
<=-------> It is used to show smaller than or equals to with another variable.Like x<=y
!=----------> I simply says , two variables are not equal in value.like x!=y
==---------->It says two variables have same value.It is used to test values of two variables.

3)Logical operator:-
                                   This operator is quite helpful when we want to combine multiple  conditions and take decision.It returns values in the form of 0 o 1.It works logically.
Its types are:

3.a)and (&&)-----------> It is called 'and'operator.It is used to combine multiple conditions.It gives us true output if all of them are true otherwise we get false output.
 example:if(a>b && a>c)
                      {
                            display a     
                        }
 we can see here that to be greatest,value of 'a' must be greater than b and c. So we use here '&&'
   
  3.b)or(||):- It is called 'or'operator.It is used to combine multiple conditions.It gives us true output if anyone of them is true or all are true otherwise we get false output.
 example:if(a==90 || b==90 || c==90)
                      {
                            display right angle triangle  
                        }
 we can see here that to be right angled triangle,either 'a'or 'b'or 'c' a must be 90 . So we use here '||'.

3.c) !(not )operator:-
                                It is used to reverse the result.
example
int a=5;
if(!(a==5))
{
printf("it is\n");
}
else
{
printf("it is not\n");
}
here ,the value is 5 but we get output "it is not".It is called reversing the output.


        d) What is a program to read a four digit number and display it in reverse order? [5]

        Ans:-

        
                /*to reverse a number*/                 #include <stdio.h>                 int main()                 {              int num;              int rem;              printf("enter a four digits number\n");              scanf("%d",&num);              while(num!=0)              {              rem=num%10;              printf("%d",rem);              num=num/10;              }           return 0;             }


2.

     a) Write a program to add two matrices.

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


    b) Write differences between structure and union with syntax.[10]

Ans:-

    
The differences between struct and union are given below in tabular form.

                   
struct
Union
1.It stores dis-similar data.Each gets separate space in memory.They do not share memory
1. It stores dis-similar type of data.Total memory space is equal to the member with largest size.They share memory space.
2.we can access member in any sequence .
2.We can access that whose value is recently used.
3.It uses keyword 'struct'
3.It uses keyword 'union'
4.We can initialize values of member/s and in any order
4.We can initialize that member which is first declared.
5.It consumes more memory
5.It consumes less memory.
6.Its syntax
    struct tag
{
datatype member1;
datatype member2;
datatype member3;
}variable;

6.Its syntax
    union tag
{
datatype member1;
datatype member2;
datatype member3;
}variable;

Example
struct student
{
int roll;
char sex;
float percentage;
}var;

Example
union student
{
int roll;
char sex;
float percentage;
}var;

3. a) Write a program to enter name, roll_number and marks of 10 students and store them in the file.[10]

Ans:-

#include<stdio.h>

int main()

{

 FILE *p;

char name[100];

int roll_number;

int eng,phy,maths,chem,csc;

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

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

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

while((scanf("%s%d%d%d%d%d%d",name,&roll_number,&eng,&phy,&maths,&chem,&csc))!=EOF)

{

 fprintf(p,"%s\t%d\t%d\t%d\t%d\t%d\t%d",name,roll,eng,phy,maths,chem,csc);

}

fclose(p);

printf("daat stored successfully\n");

return 0;

}

b) Write a program to enter 'n' number into one dimensional array and sort and display them in ascending order.[10]

Ans:-

/* program to sort 'n'  numbers in ascending 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 ascending order are=:\n");

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

{

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

}

return 0;

}

                                                                            Group 'B' (Short Answer Questions) Attempt any five questions:[5x7=35]

4. What is the local area network? Explain the different types of topologies with diagrams.[2+5]

Ans:-

Local Area Network:-

It is a privately-owned network done in single building or room or office to share resources or data, documents (for 100 m).It occupies small area and small number of computers.
Its Speed with which data is passed is extremely fast(1000mbps).It has Fastest connecting and sharing speed.For communication it uses medium like Co-axial or utp cable (mostly).
Preferd topologies can be topology like bus/star/tree etc.
There is fewer error occurrences during transmission and  Less congestion.It can be handled by single person/administrator.
It is cost effective.

Second part:-
As we know there are many types LAN 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

5. Who is a system analyst? Explain the major role 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.

6. What is normalization? Explain the normalization process with example.[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.

7. Differentiate between Internet and Intranet with suitable example.[2+5]

Ans:-

Differences are given in following paragraph.

Internet:-
1) It contains large number of computers.It is completely open/global.
2) Its access is not limited to particular organization.
3)It has/occupies large area.
4) It is not that much secured as Intranet is.
5) It uses/contains different media and technologies.
6)To access Internet, only password from ISP is needed; no more authentication is needed.
7)It is decentralized system with many hosts..
etc.
Intranet:
1)An intranet is a private computer network that uses Internet Protocol technologies to securely share any part of an organization's information or operational systems within that organization.
2)Its access is limited to an organization.
3)It has  small coverage.
4)It is safe to access personal information.
5)Locals of intranet can access Internet; and Internet requirement is not mandatory for communication.
6) Employees of an organization can access their intranet by using authorized password by using Internet; otherwise not possible.

7)We can say it as a “Centralized controlling system”.

8. Define the term polymorphism and inheritance with examples.[3.5+3.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.

9. Differentiate between while and do while loop.[3.5+3.5)

Ans:-

Differences between while and do..while loop are given below.


while loop

do while loop

In the while loop, condition is checked in the beginning.

In the do while loop, condition is checked at the end.

It is also known as a pre-test or entry control loop.

It is also known as post-test or exit control loop.

It is not terminated with a semicolon.

It is terminated with a semicolon.

In the while loop, statements are not executed if the condition is false.

In the do while loop, statements are executed once even the condition is false.

It uses the keyword ‘while’.

It uses two keywords ‘do’ and ‘while’.

The syntax of while loop is as follows:

initialization;

while(condition)

{

  statements;

  increment/decrement;

}

The syntax of do-while loop is as follows:

initialization;

do

 {

  statements;

  increment/decrement;

 }while(condition);

The operation of while loop can be represented using flowchart as follows:



The operation of do while loop can be represented using flowchart as follows:



Example:
#include<stdio.h>

int main()

{

    int i=1;

    while(i>=10)

    {

        printf("I love my country");

        i++;

    }

    return 0;

}

Output: This program displays nothing as output; as condition is evaluated false in the beginning.

Example:

#include<stdio.h>

int main()

{

    int i=1;

    do

    {

        printf("I love my country");

        i++;

    }while(i>=10);

    return 0;

}

Output: This program displays “I love my country as output at once.


10. What is data security? How it can be implemented?[2+5]

Ans:-

Data security:-

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

11. What is documentation? Explain the importance of documentation in program designing .[2+5]

Ans:-

Documentation:-

                     Suppose, we have finished development. while developing, the programmers write themselves some comments or remarks or guidelines just besides of code(or may be a separate file) or provide a separate manual which can be beneficial for them or any other programmer to understand the codes. So it is a supporting material/notes/helplines. It is must for developers to write from very beginning and in very simple manner such that IT and Non-IT persons can understand and modify if needed somewhere. It is also useful for the programmers who is/are new to a company and going to to do some changes in an existing system developed by some others.A documentation can be done for:

  • system manual: Includes relations to an environment and construction principles to be used in design of software components.installation,errors,recovery etc

  • program manual: it says about program and its components like,Technical - Documentation of code, algorithms, interfaces, and APIs.

  • users’ manual :User Documents give customers the information they need while using the product. 

   

12. Write short notes on: [3.5+3.5]

a) cyber Law b) feasibility study [3.5+3.5)

Ans:-

a)Cyber Law:-

                    
This law is commonly known as the law of the internet. It governs the legal issues of computers, Internet, data, software, computer networks and so on. These terms of legal issues are collectively known as cyberspace. In other words, it is a type of law which rules on the Internet to prevent Internet related crime.


Cyber law is a new and quickly developing area of the law that pertains to persons and companies participating in e-commerce development, online business formation, electronic copyright, web image trademarks, software and data licenses, online financial transactions, interactive media, domain name disputes, computer software and hardware, web privacy, software development and cybercrime which includes, credit card fraud, hacking, software piracy, electronic stalking and other computer related offenses.

b)Feassibility 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:
2.Operational feasibility:- It is all about problems that may arise during operations. There are two aspects related with this issue:
3) Economic feasibility: - It is the measure of cost effectiveness of the project. T
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.    

3 comments:

  1. 1xbet korean betting site - Legalbet.co.kr
    1xbet korean betting site. Register now for the 1xbet apps first time and register an account and use the new bonus code WIN1030.

    ReplyDelete
  2. The Strip And Sands Casino | Proudly Owned by MGM
    When 엠카지노에오신것을환영합니다 MGM Resorts International debuted in New York City in 2006, the casino became the 더킹 카지노 먹튀 premier m카지노에오신것을환영합니다 resort destination in the world 클레오카지노 of Las 샌즈 카지노 주소 Vegas,

    ReplyDelete
  3. Top 10 Online Casinos and Games - AprCasino
    › casino › casino Oct 2, 2021 — 바카라 사이트 Oct 2, 2021 Online casinos offer a range of games for free slots, progressive jackpots and 메리트 카지노 고객센터 real money jackpots. aprcasino.com What's the best online casino to play 실시간 바카라 사이트 위너바카라 real money slots and jackpot games? What's the best online casino to play 메리트 카지노 쿠폰 real money slots and jackpot games?

    ReplyDelete