2079 NEB Grade 12
Group 'B'
Short answer questions
10. Differentiate the centralized and
distributed database system.
The differences between centralized and distributed database
systems are given below.
|
Basis of Comparison |
OR
What are the purposes of
normalization? Give an example of 2NF.
Normalization is the process of structuring and
handling the relationship between data to minimize redundancy in the relational
table and avoid the unnecessary anomalies properties from the database like
insertion, update and delete. It helps to divide large database tables into
smaller tables and make a relationship between them. It can remove redundant
data and ease to add, manipulate or delete table fields.
Purpose of
normalization:-
·
We can summarize the purpose of normalization
as given below.
·
To correct duplicate data and database anomalies.
·
To avoid creating and updating any unwanted data connections and
dependencies.
·
To prevent unwanted deletions of data.
·
To optimize storage space.
·
To reduce the delay and complexity of checking databases when
new types of data need to be introduced.
·
To facilitate the access and interpretation of data to users and
applications that make use of the databases.
2NF:-
The data is said to be in second normalized form If,
1.It is in First normal form
2.All Non-key attributes are fully functionally dependent on the
primary key.
Example:
Let us consider following table which is in first normal form:
In above example we can see that department .Here We will see
that there is composite key as{ Employee No,Department No}.Employee No is
dependent on Employee Name and Department is dependent on Department No.We can
split the above table into 2 different tables:
Table 1:Employee_NO table
Table 2:Department table
Now we have simplified the table into a second normal form where
each entity of table is functionally dependent on the primary key.
11. Write a program to find the
factorial of any number using Javascript.
<html>
<head>
<title></title>
</head>
<body>
<script>
var i;
var factorial=1;
var n;
n=prompt("enter a number");
for(i=1;i<=n;i++)
{
factorial=factorial*i;
}
document.write("the factorial value
is",factorial);
</script>
</body>
</html>
Or
How do you fetch data from a database
in PHP and display it in form? Describe.
Let the table be student(st_id,st_grade) in our database named
‘student’. Let’s suppose this table contains some records as given here.
student
In the real scenario, these records are stored in a database i.e. table. Now we
have to fetch them and display them in text boxes(form).
For this we will use the following PHP and HTML codes.
<?php
$connect=mysqli_connect("localhost","root","","student")
or die("Connection failed");
?>
<html>
<head>
<title>
display
data from database
</title>
</head>
<body>
<table>
<tr>
<th> student
id</th><th>student grade</th>
</tr>
<form
method="post">
<?php
$query = "
select * from student";
$result =
mysqli_query($connect, $query);
while ($row =
mysqli_fetch_array($result))
{
?>
<tr>
<td>id</td>
<td> <input type="text" value="<?php echo
$row['st_id'];?>">
</tr>
<br><br>
<tr>
<td>grade</td><td><input
type="text" value="<?php echo $row['st_grade'];
?>">
</tr>
<br><br>
<?php
}
?>
</form>
</table>
</body>
</html>
12. Compare the OOPs and procedural
programing language.
OOP(Object Oriented Programming):-
The major motivating factor in the invention of object oriented
is to remove some of the flaws encountered in the procedural oriented approach.
Object oriented programming uses concept of “Object” and treats data as a
critical element in the program development and does not allow it to flow
freely around the system. It ties data more closely to the functions that
operate on it, and protects it from accidental modifications from outside
functions.
Some characteristics (features) of
Object Oriented Programming are :-
1) Emphasis is on data rather than procedures or algorithms.
2) Programs are divided into what are known as objects.
3) Data structures are designed such that characterize the
objects.
4) Functions that operate on the data are tied together in the
data structure.
5) Data is hidden and cannot be accessed by external functions.
6) Objects may communicate with each other through functions.
7) New data and functions can be easily added whenever necessary.
8) Follows bottom-up approach in program design.
Procedural Oriented Language:-
Procedure oriented programming basically consists of
writing a list of instructions(or actions) for the computer to follow, and
organizing these instructions into groups known as functions. While we
concentrate on the development , very little attention is given to the data
that are being used by various functions.
Some characteristics (features) of Procedure Oriented
Programming are :-
1) Emphasis is on doing things(algorithms).
2) Large programs are divided into smaller programs known as
functions.
3) Most of the functions share global data.
4) Data more openly around the system from function to function.
5) Functions transform data from one form to another.
6) Employs a top-down approach in program design.
13. What are the major activities
performed to design the software? Describe.
1)Problem
definition:-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 the project will be carried out.
2) System analysis:-Once
the problems are identified, it is time to analyze the type of software that
could answer the problems encountered. System analysis will take a look at
possible software. The goal of a system analysis is to know the properties and
functions of software that would answer the concerns solicited from intended
users.
3)Systems Design: In this phase we start design of proposed new system.It
describes desired features and operations in detail, including screen layouts,
business rules, process diagrams, pseudo code and other documentation.
4)System development (Coding):After
designing the new system, the whole system is required to be converted into
computer understanding language. Coding the new system into a computer
programming language does this. It is an important stage where the defined
procedures are transformed into control specifications by the help of a
computer language. This is also called the programming phase in which the
programmer converts the program specifications into computer instructions,
which we refer as programs.
5. Testing:-Before
actually implementing the new system into operations, a test run of the system
is done removing all the bugs, if any. It is an important phase of a successful
system. After codifying the whole programs of the system, a test plan should be
developed and run on a given set of test data. The output of the test run
should match the expected results.
6.Implementation: After having the user acceptance of the
new system developed, the implementation phase begins. Implementation is the
stage of a project during which theory is turned into practice. During this
phase, all the programs of the system are loaded onto the user's computer.
7.Maintenance:-Maintenance is necessary to eliminate errors in the system during
its working life and to tune the system to any variations in its working
environment. It has been seen that there are always some errors found in the
system that must be noted and corrected. It also means the review of the system
from time to time.
14 Explain the popular five-application areas of AI.
Following are major five application areas of AI.LEt’s know
about them in detail.
1.Game playing
You can buy machines that can play master level chess for a few
hundred dollars. There is some AI in them, but they play well against people
mainly through brute force computation--looking at hundreds of thousands of
positions. To beat a world champion by brute force and known reliable
heuristics requires being able to look at 200 million positions per second.
2.speech recognition
In the 1990s, computer speech recognition reached a practical
level for limited purposes. Thus United Airlines has replaced its keyboard tree
for flight information by a system using speech recognition of flight numbers
and city names. It is quite convenient. On the the other hand, while it is
possible to instruct some computers using speech, most users have gone back to
the keyboard and the mouse as still more convenient.
3. understanding natural language
Just getting a sequence of words into a computer is not enough.
Parsing sentences is not enough either. The computer has to be provided with an
understanding of the domain the text is about, and this is presently possible
only for very limited domains.
4.computer vision
The world is composed of three-dimensional objects, but the
inputs to the human eye and computers' TV cameras are two dimensional. Some
useful programs can work solely in two dimensions, but full computer vision
requires partial three-dimensional information that is not just a set of
two-dimensional views. At present there are only limited ways of representing
three-dimensional information directly, and they are not as good as what humans
evidently use.
5.Expert systems
In artificial intelligence, an expert system is a computer
system emulating the decision-making ability of a human expert. Expert systems
are designed to solve complex problems by reasoning through bodies of
knowledge, represented mainly as if–then rules.
Example:
MYCIN: It was one of the
earliest backward chaining expert systems that was designed to find the
bacteria causing infections like bacteraemia and meningitis. It was also used
for the recommendation of antibiotics and the diagnosis of blood clotting
diseases.
Group 'C'
Long answer questions
15. Compare the star and ring topology
with pros and cons. Which data communication cable is more appropriate to
design the local area network? Describe.[5+3]
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.).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.
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 topology is a network configuration where device
connections create a circular data path. Each networked device is connected to
two others, like points on a circle. Together, devices in a ring topology are
referred to as a ring network.
In a ring network, packets of data travel from one device to the
next until they reach their destination. Most ring topologies allow packets to
travel only in one direction, called a unidirectional ring network. Others
permit data to move in either direction, called bidirectional.
Advantages of a ring topology
·
All data flows in one direction, reducing the chance of packet
collisions.
·
A network server is not needed to control network connectivity
between each workstation.
·
Data can transfer between workstations at high speeds.
·
Additional workstations can be added without impacting
performance of the network.
·
Disadvantages of a ring topology
·
All data being transferred over the network must pass through
each workstation on the network, which can make it slower than a star topology.
·
The entire network will be impacted if one workstation shuts
down.
·
The hardware needed to connect each workstation to the network
is more expensive than Ethernet cards and hubs/switches.
In network communications, a transmission medium is a physical connection or
an interface between the transmitter and the receiver. There are two major
categories of transmission media, namely guided and wireless (or unguided).
Twisted Pair Cable
Twisted pair cables have been around for a long time. They were
mainly invented for voice transmissions. Twisted pair is a widely used medium
in networking because it's lighter, cheaper, more flexible, easy to install,
and provides greater speeds than coaxial cables. So in my view twisted pair
should be used for local area network.There are two types of twisted pair
cables: the unshielded twisted pair (UTP) and the shielded twisted pair (STP).
Let's take a closer look at each of them.
The unshielded twisted pair cable has 4 pairs of copper wires that are present inside a plastic sheath. These wires are twisted to protect them from interference. The only protection available for a UTP cable is a plastic sheath that is thin in size.
Twisted Pair Cable
·
Installation is easy
·
Flexible
·
Cheap
·
It has high speed capacity,
·
100 meter limit
·
Higher grades of UTP are used in LAN technologies like Ethernet.
·
It consists of two insulating copper wires (1mm thick). The
wires are twisted together in a helical form to reduce electrical interference
from similar pairs.
16. What is structure? Write a program
to input roll, name and age of 5 students and display them properly using
structure.
Structure:-Structure is a user defined data type
available in C that allows to combine data items of different kinds.
Structures are used to represent a record. Suppose we want to
keep track of your books in a library. we might want to track the following
attributes about each book −
Title
Author
Subject
Book ID
For this, structure is helpful.
Features:-
·
We can copy items of one structure to another using = operator.
·
We can use structure in nested form.
· We can pass the entire structure to a function.
·
We can create an array for a given structure.
Syntax:
structure tag name
{
Data type member 1;
Data type member2;
} variable;
Example:
struct book
{
Char b_name[100];
Char b_authro[100];
float b_price;
}v
#include <stdio.h>
struct emp
{
int roll;
char name[100];
int age;
}var[5];
int main()
int i;
printf("enter roll,name and age of students\n");
for(i=0;i<=4;i++)
{
scanf("%d",&var[i].roll);
scanf("%s",var[i].name);
scanf("%d",&var[i].age);
}
printf(" roll,name and age
are:\n");
for(i=0;i<=19;i++)
{
printf("roll=%d,name=%s,age=%d\n",var[i].roll,var[i].name,var[i].age);
}
return 0;
}
OR
Write a C program to enter ID,
employee_name, and post of the employee and store them in a data file named
"emp.txt". Display each record on the screen in an appropriate format.
#include <stdio.h>
#include<conio.h>
struct
employee
{
int employee_id;
char employee_name[50];
char employee_post[100];
}var;
int main()
{
FILE
*k;
char
choice;
k=fopen("emp.txt","w");
do
{
printf("\n enter employee id\n");
scanf("%d",&var.employee_id);
printf("enter employee name\n");
scanf("%s",var.employee_name);
printf("enter employee post\n");
scanf("%s",var.employee_post);
fprintf(k,"%d %s
%s\n",var.employee_id,var.employee_name,var.employee_post);
printf("want to continue (y/n):=\n");
choice=getche();
}while(choice!='n');
printf("\n writing process completed successfully\n");
fclose(k);
printf("-----------------------\n");
printf("reading
data\n");
k=fopen("emp.txt","r");
while((fscanf(k,"%d%s%s",&var.employee_id,var.employee_name,var.employee_post))!=EOF)
{
printf("employee id=%d,employee name=%s,employee
post=%s\n",var.employee_id,var.employee_name,var.employee_post);
}
fclose(k);
return 0;
}