2080 NEB Grade 12
Group 'B'
Short answer questions 5x5=25
10.
Explain the Relational Data model with example.
Relational
database model:
The Relational
Data Model is one of the most widely used models in database systems. It
organizes data into tables, also known as relations, where each table
consists of rows (called tuples)
and columns (called attributes). Each table represents a
specific type of entity — for example, a Students table might store
information about students, with each row representing one student and each
column representing details like name, age, or department.
|
StudentID |
Name |
Age |
DeptID |
|
1 |
Ram |
18 |
D1 |
|
2 |
Sita |
19 |
D2 |
|
3 |
Hari |
20 |
D1 |
Here,
StudentID is a primary key. Other fields are Name,age,DeptID. Rows are records.
OR
Write
SQL DDL commands to execute the following task with
reference to the schema given below:
student_info (regno as integer, name as character (25), class integer, gender
character (1), address character .
CREATE
TABLE student_info (
regno int,
name varchar(25),
class int,
gender char(1),
address varchar(5)
);
Write a server side scripting code to insert data into the table student having
fields (first name, last name, mark and email:) Assume that server
name="localhost", username="root", password=""
database name="student DB". (1+4)
Syntax
for database connectivity:
$connection
= new mysqli("server_name", "username",
"password", "database_name");
or
$connection
= mysqli_connect("server_name", "user_name",
"password", "database");
PHP
<?php
$connection
= mysqli_connect("localhost", "root", "",
"studentDB");
if
(!$connection)
{
die("Connection failed: " . mysqli_connect_error());
}
$firstname
= "Ram";
$lastname
= "Sharma";
$mark
= 85;
$email
= "ram@example.com";
$sql
= "INSERT INTO student (firstname, lastname, mark, email)
VALUES ('$firstname', '$lastname', $mark, '$email')";
if
(mysqli_query($connection, $sql))
{
echo "Record inserted successfully.";
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($connection);
}
mysqli_close($connection);
?>
Write
a JavaScript code to calculate the factorial of a given number. 5
<script>
let number = parseInt(prompt("Enter a number:"));
let f=1;
let i;
for(i=1;i<=number;i++)
{
f=f*i;
}
console.log("factorial value=",f);
</script>
Object
Oriented Programming:-
he
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.
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
Programming (POP) is a programming paradigm where the logic of the program
is built around procedures or functions. It follows
a top-down approach, meaning that the execution of the program starts from
the main function and proceeds in a sequential manner. In POP, the
primary focus is on the functions that manipulate data, which is
typically stored in global variables.
Features:-
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.
Examples:
C, Pascal, early BASIC.
System
testing:-
System
Testing plays a crucial role in the System Development Life Cycle
(SDLC) because it ensures that the software functions as expected and
meets both the technical and business requirements. It's the phase where the entire
system is tested as a whole to check for any issues, bugs, or gaps in
functionality before the system is released to the users.
Below
are the key reasons why System Testing is important:
1.
Ensures Quality and Reliability
2. Identifies Bugs and Defects
3. Validates Business Requirements
4. Verifies Compatibility
5. Performance and Load Testing
14.
What is cloud computing? Point out the advantage and disadvantage of cloud
computing
Cloud
computing:-
Cloud
Computing is the delivery of computing services (including storage,
processing power, databases, networking, software, and more) over
the internet rather than from a local server or personal computer.
The term "cloud" refers to the internet, and cloud computing
enables users to access and store data on remote servers, rather than relying
on physical hardware or on-site IT infrastructure.
The
major players in cloud computing include Amazon Web Services
(AWS), Microsoft Azure, Google Cloud, and others.
cloud
computing advantages:
1.Cost-Efficiency:Users
only pay for the services they use, reducing the need for large capital
expenditures for hardware and infrastructure.
2.Scalability
and Flexibility:
Cloud
services can be scaled up or down quickly based on demand, ensuring that
companies can meet fluctuating workloads without investing in excess hardware.
Disadvantages:
1.Data
Security and Privacy Concerns:
Storing
sensitive data on remote servers raises concerns about data
breaches, hacking, or unauthorized access.
2.Downtime
and Service Interruptions:
Cloud
services are susceptible to service outages. If the cloud provider
experiences a failure, users may be unable to access their data or services
until the issue is resolved.
Group 'C'
15.
What is network topology? Differentiate between guided (wire media) and
unguided (wireless media) with example.
Network
topology:
Network
Topology refers to the arrangement or structure of different elements (links,
nodes, devices, etc.) in a computer network. It defines how various devices in
a network are connected and how data flows within the network. There are
several types of network topologies, including bus, star, ring, mesh, hybrid,
and others, and the choice of topology affects the performance, scalability,
and reliability of the network.
Guided
(Wired Media):
Guided
media refers to physical transmission mediums where data is transmitted via
wires or cables, which guide the signal along a specific path. This type of
medium requires a physical connection between devices in the network.
Examples:
·
Twisted
Pair Cable (e.g., Ethernet cables used in local area networks).
·
Coaxial
Cable (used in cable internet connections).
·
Fiber
Optic Cable (used for high-speed, long-distance communication).
Characteristics:
·
Physical
medium: Data is transmitted through physical cables.
·
Limited
distance: The data transmission distance is limited by the type of cable used.
·
Stable
connection: Provides more stable and reliable communication compared to
wireless media.
·
Higher
security: Since the signals are confined to the physical medium, there is less
chance of unauthorized interception.
·
Requires
installation: Physical installation of cables is necessary, which can be
time-consuming and costly.
Unguided
media refers to the transmission of data through air or
space using electromagnetic waves, without the need for physical
cables or wires. It is often referred to as wireless communication.
·
Radio
Waves (used in broadcast radio and wireless LANs).
·
Microwaves (used
in satellite communications and point-to-point networks).
·
Infrared
(IR) (used in remote control devices).
·
Wi-Fi (used
in wireless networking for connecting devices).
Characteristics:
·
No
physical medium: Data is transmitted through the air using electromagnetic
signals.
·
Greater
range: Wireless communication allows data transmission over larger areas,
especially with advanced technologies like satellite or cellular networks.
·
Mobility:
Devices can move freely within the coverage area without being restricted by
physical cables.
·
Prone
to interference: Wireless signals can be affected by various factors such as
weather conditions, physical obstructions, and other devices operating on the
same frequency.
·
Lower
security: Wireless signals are more vulnerable to interception, and extra
security measures such as encryption are needed to prevent unauthorized access.
Pointer
and its advantages:
A pointer is
a variable that stores the memory address of another variable.
Instead of holding a data value directly, a pointer "points to" the
location in memory where the value is stored.
In
C, pointers are declared using the asterisk (*) symbol.
Example:
int *p; //p is a pointer
·
They
allow efficient memory management by enabling dynamic allocation and
deallocation of memory during runtime.
·
Pointers
also lead to faster program execution as they offer direct access to
memory locations.
·
One
key advantage is that pointers support call by reference, allowing
functions to modify the actual values of variables passed to them.
·
They
are essential in implementing advanced data structures such as linked
lists, trees, stacks, and queues.
#include
<stdio.h>
void
calculateArea();
{
calculateArea();
return 0;
}
void
calculateArea()
{
float radius, area;
printf("Enter the radius of the football: ");
scanf("%f", &radius);
area = 4 * 3.14 * radius * radius;;
printf("The surface area of the football is: %.2f square
units\n", area);
}
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:
struct
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
staff
{
int staff_id;
char staff_name[200];
float staff_salary;
};
int
main()
{
struct staff v[50];
int i;
for(i=0;i<=4;i++)
{
printf("enter staff
id\n");
scanf("%d",&v[i].staff_id);
printf("enter staff
name\n");
scanf("%s",&v[i].staff_name);
printf("enter staff
salary\n");
scanf("%f",&v[i].staff_salary);
}
printf("the records
are:\n");
for(i=0;i<=4;i++)
{
if(v[i].staff_salary>=25000
&& v[i].staff_salary<=40000)
{
printf("staff
id=%d\n",v[i].staff_id);
printf("staff
name=%s\n",v[i].staff_name);
printf("staff
salary=%f\n",v[i].staff_salary);
}
}
return 0;
}