NEB year 2063 computer science questions
old syllabus:
----------------------------------------------
2063 (2006) Group 'A' (Long Answer Questions)
Attempt any two of the following questions:[2x20 = 40]
1.
a) Write is looping? Write a C Program do display the sum of 'n' terms of even numbers. [2+3]
Ans:-
Looping:-
A control structure where some statements' executions are repeated again and again till the condition is satisfied.As the condition becomes false, further execution stops.this is called loop.
Second part:-
/*Program do display the sum of 'n' terms of even numbers*/
#include<stdio.h>
int main()
{
int k=0,n,sum=0;
scanf("%d",&n);
while(k<=n)
{
k=k+2;
}
printf("sum=%d",sum);
b) Write a C Program to calculate the factorial of a given number using functions. [5]
Ans:-
#include<stdio.h>
void fact();
int main()
{
fact();
return 0;
}
void fact()
{
int number,fact=1,i;
scanf("%d",&number);
if(number>0)
{
for(i=1;i<=number;i++)
{
fact=fact*i;
}
}
else
{
printf("the number is not +ve\n");
}
printf("the factorial value for entered number=%d is =%d\n",number,fact);
}
c) What is an operator? Describe different types of operators that are included in [2+3]
Ans:-
operator:- It is a symbol or a character used in programming. It is used to carry out some operation.
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
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.
4) Assignment operator:
an operator ,symbolized by '=' character,is called assignment operator.It assigns value to variable.
example:
int a=6;
It means, we are assignming value 6 to variable a.
5)Unary operator:- this operator works on one operand only.It has two types.
I) increment operator:- It increases the value of given variable by one.For example: ++y or y++
It can be classified into pre-increment and post increment.
pre-increment:- It is written as ++x.It means first increase the value and then use that.
post-increment: It is written as x++.It means, first use that and then increase its value by one.
II)decrement operator:- It decreases the value of given variable by one.For example: --y or y--
It can be classified into pre-decrement and post decrement.
pre-decrement:- It is written as --x.It means first decrease the value and then use that.
post-decrement: It is written as x--.It means, first use that and then decrease its value by one.
d) What are the differences between break and continue statement? Write a C Program to print first 10 terms of the following series using 'for' loop [2+3]
1,5,9, 13...
Ans:-
Differences are given below:-
break | continue | |
1 | It terminates the execution. | It takes the iteration to next level(skipping). |
2 | It can be used in loop and switch. | It can be used in switch |
3 | It uses keyword ‘break’. | It uses keyword ‘continue’. |
4 | Its syntax is break; | Its syntax is continue; |
5 | Example is For(i=1;i<=4;i++) { If(i<=2) Printf(“%d\n”,i); Break; } } | Example is For(i=1;i<=4;i++) { If(i<=2) Printf(“%d\n”,i); continue; } } |
output is:1 | output is:1,2 |
Second part:-
/*Program to print first 10 terms of the following series 1,5,9, 13... using 'for' loop*/
#include<stdio.h>
int main()
{
int k,p=1;
for(k=1;k<=10;k++)
{
printf("%d,",p);
p=p+4;
}
return 0;
}
2.
a) What is any array? Write a C Program to sort integer values in descending order.[2+8]
Ans:-
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) |
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) Write a C Program to read age of 40 students and count the number of students of the age between 15 and 22.[10]
Ans:-
/*C Program to read age of 40 students and count the number of students of the age between 15 and 22*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,count=0;
in age[40];
for(i=0;i<39;i++)
{
printf("enter age\n");
scanf("%d",&age[i]);
if(age[i]>=15 && age[i]<=22)
{
count++;
}
}
printf("total students getting in age group 15 and 22=%d\n",count);
getch();
}
3. a) Differentiate between structures and pointers with examples.[10]
Ans:-
We can understand structure and pointer with the help of following points/explanations.
structture:-
Definition: The user defined data type which can store the data of various data types such as int, char etc. is called Structure.
It is used to hold all the facts of single objects.
Example: Book [publication, title, author, price, page];
Student [roll no, class, name, telephone no, age];
There are 3 phases in structure.
1. Design Phase
2. Declaration phase
3. Data access phase
A pointer is a variable that stores a memory address. Pointers are used to store the addresses of other variables or memory items. Pointers are very useful for another type of parameter passing, usually referred to as Pass By Address. Pointers are essential for dynamic memory allocation.
some advantages:
1.It handles memory effectively.
2.Useful in file handling
3.Reduces spaces.
4.Reduces execution time.
Example:
#include<stdio.h>
int main()
{
int *k;
int m=90;
k=&m;
printf("address=%d",k);
printf("value=%d",*k);
return 0;
}
here , k is a pointer and will store address of a variable m. It is then printed using printf(). To print its value we have to use indirection operator.
b) Write a C program with a menubase system which has the following features: [10] i. Appending record ii. Reading Record iii. Delete record iv. Quit
Ans:-
//menu based program to store, read and delete record of students
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
char name[100],address[100],section[100];
int grade,roll,droll;
FILE *p,*p1;
system("cls");;
char choice;
printf(" you have following choice......\n");
printf("----------------------------------------------------------\n");
printf("'a' or 'A' to store or add more(append)
data\n");
printf("'r' or 'R' to display records/read\n");
printf(“’d’ or’D’ to delete record\n”);
printf(“any other character to exit\n”);
printf(" enter your choice......\n");
choice=getche();
switch(choice)
{
case 'a':
case 'A':
system("cls");
printf("\nwe
are going to add/store data\n");
char ch='y';
FILE *p;
p=fopen("record.txt","a");
printf("----------------------------------------------------------------\n");
while(ch!='n')
{
printf("\n");
printf("enter
student's name\n");
scanf("%s",name);
printf("enter
student's address\n");
scanf("%s",address);
printf("now
enter student's section\n");
scanf("%s",section);
printf("enter his/her grade\n");
scanf("%d",&grade);
printf("now
enter his/her roll no.\n");
scanf("%d",&roll);
fprintf(p,"%s
%s %s %d %d\n",name,address,section,grade,roll);
printf("you
want to continue?\n");
printf("press
y/Y to contnue and 'n' to discontinue..\n");
ch=getche();
}
fclose(p);
break;
case 'r':
case 'R':
system("cls");
printf("\nwe
are going to display/read records\n");
p=fopen("record.txt","r");
printf("----------------------------------------------------------------\n");
while((fscanf(p,"%s
%s %s %d %d\n",name,address,section,&grade,&roll))!=EOF)
{
printf("name=%s,address=%s,",name,address);
printf("
section=%s,grade=%d and roll=%d\n",section,grade,roll);
printf("--------------------------------------------------------------\n");
}
fclose(p);
break;
case 'd':
case 'D':
printf(“we are
going to delete a record\n”);
p=fopen("record.txt","r");
p1=fopen(“temp.txt”,”w”);
printf("----------------------------------------------------------------\n");
printf(“enter
roll number to be deleted\n”);
scanf(“%d”,&droll);
while((fscanf(p,"%s
%s %s %d%d\n",name,address,section,&grade,&roll))!=EOF)
{
if(roll==droll)
printf(“this record has been
deleted\n”);
else
fprintf(p1,"%s %s %s %d
%d\n",name,address,section,grade,roll);
}
fclose(p);
fclose(p1);
printf("data
updated!!!!\n");
remove("record.txt");
rename("temp.txt","record.txt");
break;
default:
printf("\nsorry,
this choice is not available..so terminating the program\n");
printf("thank
u for using this program..\n");
exit(0);
}
getch();
return 0;
}
Group 'B' (Short Answer Questions)[5x7= 35]
Attempt any five questions:
4. What is system analysis? Explain the different steps of system development life cycle.[2+5=7]
Ans:-
System ananlysis:-
System Analysis would lead in determining the requirements needed in software. These requirements in software should be implemented otherwise the software may not answer the concerns or may lack in its usage. This stage will somehow determine how the software should function.
It is the study of complete business system or parts of business system and application of information gained from that study to design,documentation and implementation of new or improved system. This field is closely related to operations research. An analyst work with users to determine the expectation of users from the proposed system.
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. Explain the term Polymorphism and Inheritance.
Ans:-
6. Define database administrator. Explain the duties and responsibilities of a database administrator. [2+5]
Ans:-
Database Administrator:-
A database administrator can be a user or a group of users. They collectively handle the database related jobs. DBA primary job is to ensure that data is available, protected from loss and corruption, and easily accessible as needed.1. Software installation and Maintenance
A DBA often collaborates on the initial installation and configuration of a new Oracle, SQL Server etc database.
2. Data Extraction, Transformation, and Loading
Known as ETL, data extraction, transformation, and loading refers to efficiently importing large volumes of data that have been extracted from multiple systems into a data warehouse environment.3. Database Backup and Recovery
DBAs create backup and recovery plans and procedures based on industry best practices, then make sure that the necessary steps are followed. Backups cost time and money, so the DBA may have to persuade management to take necessary precautions to preserve data.4. Security
A DBA needs to know potential weaknesses of the database software and the company’s overall system and work to minimise risks. No system is one hundred per cent immune to attacks, but implementing best practices can minimise risks.5. Authentication
Setting up employee access is an important aspect of database security. DBAs control who has access and what type of access they are allowed. For instance, a user may have permission to see only certain pieces of information, or they may be denied the ability to make changes to the system.7. Write short notes on any two:[3.5+3.5]
a) „Client server network ii) Workstation c) Protocol
Ans:-
a)client server network:
- 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.
b)Workstation:
Workstation, a high-performance computer system that is basically designed for a single user and has advanced graphics capabilities, large storage capacity, and a powerful central processing unit. ... Workstations are used primarily to perform computationally intensive scientific and engineering tasks.workstations may come with more cores per CPU or support multiple, separate CPUs for even more parallel processing capability. In addition, workstations often come standard with more RAM and larger, faster hard drives than the typical desktop has.c)Protocol:
A communications protocol is a formal description of digital message formats and the rules for exchanging those messages in or between computing systems and in telecommunications. Protocols may include signaling, authentication and error detection and correction capabilities. A protocol describes the syntax, semantics, and synchronization of communication and may be implemented in hardware or software, or both.
We have many examples like http, ftp, stp, tcp/IP etc.
TCP is one of the main protocols in TCP/IP networks. Whereas the IP protocol deals only with packets, TCP enables two hosts to establish a connection and exchange streams of data. TCP guarantees delivery of data and also guarantees that packets will be delivered in the same order in which they were sent.
8. What is normalization? Explain the normalization process with examples. [2+5]
Ans:-
Normalization:-
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
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.
An entity is said to be in the third normal form when,
1) It satisfies the criteria to be in the second normal form.
2) There exists no transitive functional dependency. (Transitive functional dependency can be best explained with the relationship link between three tables. If table A is functionally dependent on B, and B is functionally dependent on C then C is transitively dependent on A and B).
Example:
Consider a table that shows the database of a bookstore. The table consists of details on Book id, Genre id, Book Genre and Price. The database is maintained to keep a record of all the books that are available or will be available in the bookstore. The table of data is given below.
Book id | Genre id | Book genre | price |
121 | 2 | fiction | 150 |
233 | 3 | travel | 100 |
432 | 4 | sports | 120 |
123 | 2 | fiction | 185 |
424 | 3 | travel | 140 |
The data in the table provides us with an idea of the books offered in the store. Also, we can deduce that BOOK id determines the GENRE id and the GENRE id determines the BOOK GENRE. Hence we can see that a transitive functional dependency has developed which makes certain that the table does not satisfy the third normal form.
Book id | Genre id | price |
121 | 2 | 150 |
233 | 3 | 100 |
432 | 4 | 120 |
123 | 2 | 185 |
424 | 3 | 140 |
table book
Genre id | Book genre |
2 | fiction |
3 | travel |
4 | sports |
table genre
After splitting the tables and regrouping the redundant content, we obtain two tables where all non-key attributes are fully functional dependent only on the primary key.
When all the column in a table describe and depend upon the primary key,the table is 3N.
9. Define the term multimedia. Explain the application areas of multimedia.[2+5]
Ans:-
2)Multimedia in Entertainment: Computer graphics techniques are now commonly use in making movies and games. this increase the growth of multimedia.
3)Movies: Multimedia used in movies gives a special audio and video effect. Today multimedia has totally changed the art of making movies in the world. Difficult effect, action are only possible through multimedia.
4)Games: Multimedia used in games by using computer graphics, animation, videos have changed the gaming experience. Presently, games provides fast action, 3-D effects and high quality sound effects which is only possible through multimedia.
5)Multimedia in Business: Today multimedia is used in every aspect of business. These are some of the applications:
10. What is networking? Explain the advantage and disadvantages of networking .[2+5]
Ans:-
Networking:-
A computer network, often simply referred to as a network, is a collection of computers and devices connected by communications channels that facilitates communications among users and allows users to share resources with other users. Networks may be classified according to a wide variety of characteristics.
Purpose of networking:-
Networking for communication medium (have communication among people;internal or external)
Resource sharing (files, printers, hard drives, cd-rom/)
Higher reliability ( to support a computer by another if that computer is down)
Higher flexibility( different system can be connected without any problems)
- Sharing devices such as printers saves money.
- Site (software) licences are likely to be cheaper than buying several standalone licences.
- Files can easily be shared between users.
- Network users can communicate by email and instant messenger.
- Security is good - users cannot see other users' files unlike on stand-alone machines.
- Data is easy to backup as all the data is stored on the file server.
1.Purchasing the network cabling and file servers can be expensive.
2.Managing a large network is complicated, requires training and a network manager usually needs to be employed.
3.If the file server breaks down the files on the file server become inaccessible. Email might still work if it is on a separate server. The computers can still be used but are isolated.
4.Viruses can spread to other computers throughout a computer network.
5.There is a danger of hacking, particularly with wide area networks. Security procedures are needed to prevent such abuse, eg a firewall.
11. What are the different symbols used to construct a flow chart? Give explanation along with a neat diagram. [7]
Ans:-
Flowchart:-
A very powerful tool which is used to depict the algorithm diagrammatically. Or graphical representation of algorithm is called flowchart. A flowchart can show and give us a bird eye view of algorithm. We can understand easily what an algorithm willing to say. While designing or drawing flowchart, we use many symbols like:
Advantages:
1. Good means of communication.
2. Effective analysis
3. As Documentation tool
4. Helps in debugging process.
Disadvantages”
1. Time consuming.
2. More space consuming
3.Difficult to maintain
eg. 1. to get sum of two numbers.
12. Write short notes on any two: [3.5+3.5]
a) Feasibility study b)Data security Data security c)E-commerce
Ans:-
a)Feasibility study:-
It has following types.
b)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.
We can apply following methods to secure our data.
Antivirus and anti-malware software.
Behavioral analytics.
Data loss prevention.
Firewalls.
c)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
source:-
smallbusiness.chron.com
merriam-webster.com
content.dsp.co.uk
No comments:
Post a Comment