NEB year 2067 computer science questions
old syllabus:
GROUP-A (2x20=40)
Attempt any two questions.
q1)
a)What is looping?Write a program to print first 10 terms of the following series using for loop.
5,9,13....[2+3]
Ans:-
Loop:-
It simply says execution of different statements/blocks again and again repeatedly under certain condition. When the condition dissatisfies, the execution stops. This is called iteration or looping.
second part:-
/* a program to print 5,9,13... 10th term*/
#include<stdio.h>
int maini()
{
int i,k=5;
for(i=1;i<=10;i++)
{
printf("%d,",k);
k=k+4;
}
return 0;
}
b)Write a recursive function to calculate the factorial of an integre number.[5]
Ans:-
/*recursive function to find factorial value*/
#include <stdio.h>
int fact(int);
int main()
{
int number;
printf("enter a number\n");
scanf("%d",&number);
printf("factorial value is=%d",fact(number));
return 0;
}
int fact(int n)
{
if(n<=0)
return 1;
else
return n*fact(n-1);
}
c)WRite a program to display all prime number from 1 to 100.
Ans:-
#include <stdio.h>
int main()
{
int i,j;
int count=0;
for(i=2;i<=100;i++)
{
for(j=1;j<=i;j++)
{
if(i%j==0)
{
count++;
}
}
if(count==2)
printf("%d,",i);
count=0;
}
return 0;
}
d)What do you mean by string manipulation?Explain about strcpy and strcat functions.[2+3]
Ans:-
String manipulation function:-
Syntax:-
strcpy(string1,string2);
or strcpy(destination,source);
When we copy string, this is done from source to destination (string2 to string1). If first is empty then there would not be over-writing.
Example;
#include<stdio.h>
#include<string.h>
void main()
{
char string1[100]="APPLE";
char string2[100]="grapes";
printf("copied string =%s",strcpy(string1,string2));
}
output-
We get here string1=grapes. Because 'grapes' is copied to firs string named "APPLE". We can also write in reverse order.
The strcat() function is used to join or concatenate one string into another string.
Syntax:
strcat(strl,str2);
where str1,str2 are two strings. The content of string str2 is concatenated with string str1.
#include <stdio.h>
#include<string.h>
int main()
{
char str1[100],str2[100];
printf("Enter two strings = ");
scanf("%s%s",str1,str2);
strcat(str1,str2);
printf("After copying the string is %s ", str1);
return 0;
}
q2)
a)How do you declare an array?Write a program to arrange the elements of an array in descending order.[3+7]
Ans:-
Array:-
Definition: A composite variable capable of holding multiple data of same data type under a single variable name is called array.
Declaration of Array:
datatype array_name [size];
Example: - int marks [10]; int x[4]={1,2,3,4};
Array size is fixed at the time of array declaration.
Generally, we use for loop () to assign data or item in memory and also use this loop to extract data from memory location.
Types of Array:
There are 2 types of array.
a) One Dimensional Array (1-D): IT is an array where we use one subscript value.It stores value in row in contigous cells.
b) Two Dimensional Array (2-D):an array where we may use two or more than two subscript values.
| Column zero | Column one |
Row 0 Ã | 1(0,0) | 2(0,1) |
Row 1Ã | 3(1,0) | 4(1,1) |
/* program to sort n elements in descending order and print them.
*/
#include <stdio.h>
int main()
{
int numbers[100];
int n,i,j,k;
printf("enter the size of n\n");
scanf("%d",&n);
printf("Enter numbers\n");
for(i=0;i<n;i++)
{
scanf("%d",&numbers[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(numbers[i]<numbers[j])
{
k=numbers[i];
numbers[i]=numbers[j];
numbers[j]=k;
}
}
}
printf("numbers in descending order are=:\n");
for(i=0;i<n;i++)
{
printf("%d\n",numbers[i]);
}
return 0;
}
b)What are differences between library function and user defined functions?Write a program using user defined function to calculate y raise to power of x.[5+5]
Ans:-
Library function: 1.This is a function existing inside the library.
2.It can only be used.
3.Further modification is not allowed.
4.We need header file for this.
e.g. sqrt() or printf()
User defined function:-1.This is a function created by user.
2.It can be used or created.
3.We can modify ourselves.
4.Header file is not needed.
e.g.
void sum()
SEcond part:-
//program to get y raise to power x using user defined function.
#include<stdio.h>#include<conio.h>
#include<math.h>
void powervalue();
void main()
{
powervalue();
getch();
}
void powervalue()
{
int x,y,output;
printf("enter base value\n");
scanf("%d",&x);
printf("enter power value\n");
scanf("%d",&y);
output=pow(x,y);
printf("the output =%d\n",output);
getch();
}
q3)
a)Differentiate between array and structure with examples.[10]
Ans:-
Differences between array and struct are given below.
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; |
b)Write a program to delete and rename the data file using remove() and rename() command.[10]
Ans:-
remove():this function is used to delete data file from the system.
GROUP-B (5x7=35)
Attempt any five questions.
q4)What is system ananlyst?Explain the roles of system analyst.[2+5]
Ans:-
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.
q5)What is feasibility study?Explain the different levels of feasibility study.[2+5]
Ans:-
It has following types.
q6)What is network topology?Explain different types of topology with diagrams.[7]
Ans:-
As we know there are many types topologies.
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.
- 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
4.Shutting down of one node leads entire networking to be down
3.Bus topology:
A linear bus topology consists of a main run of cable with a terminator at each end (See fig. 1). All nodes (file server, workstations, and peripherals) are connected to the linear cable.
Fig. 1. Linear Bus topology
Advantages of a Linear Bus Topology
Installation is easy and cheap to connect a computer or peripheral to a linear bus.
Requires less cable length than a star topology.
Disadvantages of a Linear Bus Topology
Entire network shuts down if there is a break in the main cable.
Difficult to identify the problem if the entire network shuts down.
Not meant to be used as a stand-alone solution in a large building.
q7)Write short notes on:
a)Data security
Ans:-
It simply says protection of data /information contained in database against unauthorized access, modification or destruction. The main condition for database security is to have “database integrity’ which says about mechanism to keep data in consistent form. Besides these all, we can apply different level of securities like:
- Physical: - It says about sites where data is stored must be physically secured.
- Human: - It is an authorization is given to user to reduce chance of any information leakage or manipulation.
- Operating system: We must take a foolproof operating system regarding security such that no weakness in o.s.
- Network: - since database is shared in network so the software level security for database must be maintained.
- Database system: - the data in database needs final level of access control i.e. a user only should be allowed to read and issue queries but not should be allowed to modify data
b)E-commerce
Ans:-
- Online shopping web sites for retail sales direct to consumers
- Providing or participating in online marketplaces, which process third-party business-to-consumer or consumer-to-consumer sales
- Business-to-business buying and selling
- Gathering and using demographic data through web contacts and social media
- Business-to-business (B2B) electronic data interchange
- Marketing to prospective and established customers by e-mail or fax (for example, with newsletters)
- Engaging in pretail for launching new products and services
q8)What is normalization?Explain normalization process with examples.[2+5]
Ans:-
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.
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)
);
A table is said to be in 2 N if it is in 1N and there is no redundant data in table i.e. if a value of column is dependent on one column(primary key only) but not another.
For example:
Create table employee
(
Emp_no integer not null,
L-name varchar(20) not null,
F_name varchar(20),
Dept_code integer,
Description varchar(50),
);
This table contains redundant data i.e. the value of column(field) “description” depends on dept_code but does not depend on primary key “emp_no”.So let’s make a new table and shift them into that.
Create table employee
(
Emp_no integer not null,
L_name varchar(20) not null,
F_name varchar(20),
Dept_code integer,
);
Create table department
(
Dept_code integer not null,
Description varchar(50) not null,
);
We got two tables named employee and department with fields. Both the tables are related by primary key called dept_code. Now there is no redundancy and table is in 2N.
q9)Explain terms terms polymorphism and inheritance.[2+5]
Ans:-
q10)What is Internet?What is the use of Internet in business?[2+5]
Ans:-
Internet is a web of networks i.e. interconnection of large number of computers throughout the world. The computers are connected (wired or wireless via satellite) in such a way that anybody from anywhere can access anything/ information. It is the largest network in the world just like a communication service provided by different companies.
Internet in business:-
Internet helps us to control everything related to online transactions, statements,bill payments etc.Not only thtat much it is also being used to book a ticket for bus or plane or may be taxi.Now-a-days, we can call a taxi at our doorstep using mobile apps.No bargaining is needed. That app calcualtes the total fair.In Nepal, some pouplar e-coomerce sites like daraz.com.np, sastodeal.com,okdam etc are successfully running and providing better service to its customers. We do not need to go anywhere. just need an app and control everything.
this was about only national level of marketting.If we want to to marketing internationally then this is the best option.We can easily promote our business or product all over the world and can reach millions of customers,That is called B2B business.It also includes B2C.
q11)What do you understand by the term "data integrity"?Why is it important thing to be considered while designing a database?Explain.[2+5]
Ans:-
Data integrity:
Integrity is consistency of actions, values, methods, measures, principles, expectations and outcome.
Data integrity is a term used in computer science and telecommunications that can mean ensuring data is "whole" or complete, the condition in which data are identically maintained during any operation (such as transfer, storage or retrieval), the preservation of data for their intended use, or, relative to specified operations, the a priori expectation of data quality.
Entity integrity concerns the concept of a primary key. Entity integrity is an integrity rule which states that every table must have a primary key and that the column or columns chosen to be the primary key should be unique and not null. It means the primary key’s data must not be missing in table/s.
Referential Integrity
Referential integrity ensures that the relationship between the primary key (in a referenced table) and the foreign key (in each of the referencing tables) is always maintained. The maintenance of this relationship means that:
A row in a referenced table cannot be deleted, nor can the primary key be changed, if a foreign key refers to the row. For example, you cannot delete a customer that has placed one or more orders.
A row cannot be added to a referencing table if the foreign key does not match the primary key of an existing row in the referenced table. For example, you cannot create an order for a customer that does not exist.
Domain Integrity
Domain (or column) integrity specifies the set of data values that are valid for a column and determines whether null values are allowed. Domain integrity is enforced by validity checking and by restricting the data type, format, or range of possible values allowed in a column.
Importance:-
This integrity concept is used to handle/manage:
1.reduce redundancy
2.Maintain consistency
3.To handle simple as well as complex query
4.to link tables
5.to avoid wrong or invalid entry of data.
etc.
q12)Write short notes on:
a)Co-axial cable
Ans:-
- 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
b)Satellite:-
In the context of spaceflight, a satellite is an object which has been placed into orbit by human endeavor. Such objects are sometimes called artificial satellites to distinguish them from natural satellites such as the Moon.
Satellites are usually semi-independent computer-controlled systems. Satellite subsystems attend many tasks, such as power generation, thermal control, telemetry, altitude control and orbit control
satellite has on board computer to control and monitor system.
Additionally, it has radio antennae (receiver and transmitter) with which it can communicate with ground crew.Most of the satellites have attitude control system(ACS).It keeps the satellite in right direction.
Common types include military and civilian Earth observation satellites, communications satellites, navigation satellites, weather satellites, and research satellites. Space stations and human spacecraft in orbit are also satellites.
Satellite orbits vary greatly, depending on the purpose of the satellite, and are classified in a number of ways. Well-known (overlapping) classes include low Earth orbit, polar orbit, and geostationary orbit.
No comments:
Post a Comment