NEB year 2066 computer science questions
old syllabus:
-----------------------
Group-A (2x20=40)
Attempt any two questions.
q1)
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];
Ans:-
Algorithm:
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
#include <stdio.h>
int main()
{
float sp,cp,gain,loss;
printf("Enter selling price and cost price : ");
scanf("%f%f",&sp,&cp);
if(sp>cp)
{
gain=sp-cp;
printf("Gain = NPR. %0.2f",gain);
}
else
{
loss=cp-sp;
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]
Ans:-
/*WAP to display the name of day on the basis of entered number 1 to 7 using switch.
For example, 1 for Sunday.*/
#include<stdio.h>#include<conio.h>
#include<string.h>
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");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("It's Sunday\n");
break;
case 2:
printf("It's Monday\n");
break;
case 3:
printf("IT's Tuesday\n");
break;
case 4:
printf("It's Wednesday\n");
break;
case 5:
printf("It's Thrusday\n");
break;
case 6:
printf("It's Friday\n");
break;
case 7:
printf("It's Saturday\n");
break;
default:
printf("sorry, not a valid input\n");
printf("thank u, terminating....\n");
}
getch();
}
c)Write a program to input an integer number and check whether it is prime or not.[5]
Ans:-
#include <stdio.h>
int main()
{
int i,n;
printf("entera number\n");
scanf("%d",&n);
int count=0;
for(i=1;i<=n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count==2)
printf("%d is prime,",n);
else
printf("%d is composite,",n);
return 0;
}
d)Explain data types used in C programming language with example.[5]
Ans:-
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:-
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,
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.
Q2)
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]
Ans:-
/*
b)Write a program to find the sum of 'n' integer number using function.[10]
Ans:-
//program to get sum of 'n' integers using function.
#include<stdio.h>#include<conio.h>
void sum();
void main()
{
sum();
getch();
}
void sum()
{
printf("enter value of 'n'\n");
scanf("%d",&n);
while(k<=n)
{
sum=sum+k;
k++;
}
printf("sum=%d",sum);
}
q3)
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]
Ans:-
#include<stdio.h>
int main()
{
FILE *p;
char name[100];
int stdno;
int eng,phy,maths,chem,csc;
p=fopen("student.dat","w");
printf("enter name,student no.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,&stdno,&eng,&phy,&maths,&chem,&csc))!=EOF)
{
fprintf(p,"%s\t%d\t%d\t%d\t%d\t%d\t%d",name,stdno,eng,phy,maths,chem,csc);
}
fclose(p);
p=fopen("student.dat","r");
printf("data are\n");
while((fscanf(p,"%s%d%d%d%d%d%d",name,&stdno,&eng,&phy,&maths,&chem,&csc))!=EOF)
{
printf("name=%s,stdno=%d, english=%d,physics=%d,maths=%d,chemistry=%d ,csc=%d \n",name,stdno,eng,phy,maths,chem,csc);
}
fclose(p);
return 0;
}
b)Differentiate array and structure with examples.[10]
Ans:-
Differences between array and struct are given below.
Array | struct |
---|---|
1.It stores same type of data | 1. 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; |
Group-A (5x7=35)
Attempt any five questions.
4. Define Network Architecture. Explain client-server and peer-to-peer networking. [2+5]
Ans:-
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.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.
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]
Ans:-
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.
- Breaks the massive problem into smaller subproblems.
- Submodules are solitarily analysed
- communication is not required in the top-down approach.
- Contain redundant information.
- Structure/procedural oriented programming languages (i.e. C) follows the top-down approach.
- It is mainly used in Module documentation, test case creation, code implementation and debugging.
- Solves the fundamental low-level problem and integrates them into a larger one.
- Examine what data is to be encapsulated, and implies the concept of information hiding.
- Needs a specific amount of communication.
- Redundancy can be eliminated.
- Object-oriented programming languages (like C++, Java, etc.) follows the bottom-up approach.
- It is used mainly intesting.
6. Explain about OSI/ISO model of networking,[7]
Ans:-
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]
Ans:-
Database:-
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.
Advantages
Reduced data redundancy
Improved data security
Reduced data entry, storage, and retrieval costs
Facilitated development of new applications program
DBMS:-
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.
etc
8. Explain about the importance of computer security in this knowledge based society. [7]
Ans:-
Some common cyber attacks done to harm our server/computers:
2.Denial of Service
3.Backdoor attack
4.Direct Access Attack
9. What are the different program logic tools? Explain about the decision table and decision tree with examples.[2+5]
Ans:-
Different program logic tools are given below.
1.Algorithm
2.Flowchart
3.Pseudocode
4.Decision table
5.Decision tree
6.DFD
7.UML
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
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]
Ans:-
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.
etc.
11. Explain about the different testing techniques during the system development [7]
Ans:-
- Unit Testing.
- Integration Testing:-
- System Testing:-
- Acceptance Testing:
- Performance Testing:-
- Security Testing
- Usability Testing
12. Write short notes: [3.5+3.5)
a)E-commerce b) Inheritance
Ans:-
E-commerce:-
- 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:-
sources:-
techdifferences.com
smartbear.com
Top 10 casino games from RealTime Gaming
ReplyDeleteThe 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