2082 NEB Grade 12
GROUP
B – Short Answer Questions (5 × 5 = 25)
DDL (Data Definition Language)
·
Used
to define or change the structure of database objects.
·
Changes
are permanent.
·
Works
on table structure, not data.
Examples:CREATE,
ALTER, DROP
DML (Data Manipulation Language)
·
Used
to manipulate data stored in tables.
·
Changes
can be rolled back.
·
Works
on records/data.
Examples:
INSERT, UPDATE, DELETE, SELECT
|
DDL (Data Definition Language) |
DML (Data Manipulation Language) |
|
DDL is used to define, modify, or
delete the structure of database objects such as tables and schemas. |
DML is used to insert, update, delete,
or retrieve data stored in database tables. |
|
DDL commands make permanent changes to
the database structure and are automatically committed. |
DML commands do not permanently change
data unless they are committed.
|
|
DDL affects the schema or structure of
the database rather than the actual data. |
DML affects the actual records or data
present in the database tables. |
|
Examples of DDL commands include CREATE,
ALTER, DROP |
Examples of DML commands include
INSERT, UPDATE, DELETE, and SELECT. |
Normalization is technique of organizing data in the database. It is a systematic approach of decomposing tables to eliminate data redundancy and inconsistency.
Advantages
· It reduces data redundancy and inconsistency.
· It helps to optimize memory space.
· Less risk of mistakes.
Disadvantages
· It creates many tables, making database structure complex.
· It can slow data retrieval.
· It is difficult to understand and manage, especially for the beginners.
Un- normalized table
Roll No. | Name | Subject | Teacher | Department |
1 | Ram | Account, Nepali | Hari, Gita | Account,Nepali |
2 | Sita | Nepali | Gita | Nepali |
1NF
Roll No. | Name | Subject | Teacher | Department |
1 | Ram | Account | Hari | Account |
1 | Ram | Nepali | Gita | Nepali |
2 | Sita | Nepali | Gita | Nepali |
· 1NF means each field should contain only one value, not multiple values together.
· In above example, subjects and teachers are split into separate rows so there is only one subject and one teacher per row.
· This removes repeating groups and makes the table easier to read and search.
2NF
Student
Roll No. | Name |
1 | Ram |
2 | Sita |
Subject
Subject | Teacher | Department |
Account | Hari | Account |
Nepali | Gita | Nepali |
Enrollment
Roll No. | Subject |
1 | Account |
1 | Nepali |
2 | Nepali |
· 2NF means the table is already in 1NF and all non-key data depends on the whole primary key.
· In above example, student details are moved to a Student table and subject details to a Subject table, instead of repeating them.
· This reduces duplication of data like student names and teacher information.
3NF
Student
Roll No. | Name |
1 | Ram |
2 | Sita |
Teacher
Teacher | Department |
Hari | Account |
Gita | Nepali |
Subject
Subject | Teacher |
Account | Hari |
Nepali | Gita |
Enrollment
Roll No. | Subject |
1 | Account |
1 | Nepali |
2 | Nepali |
· 3NF means the table is in 2NF and there are no indirect dependencies.
· In above example, teacher and department information is separated so the department depends only on the teacher, not on the subject.
· This avoids repeating department data and keeps each fact stored in only one place.
1NF (First Normal Form) | 2NF (Second Normal Form) | 3NF (Third Normal Form) |
1NF removes multiple values from a single field and ensures each cell contains only one value. | 2NF removes partial dependency by making sure non-key attributes depend on the full primary key. | 3NF removes transitive dependency so non-key attributes depend only on the primary key. |
In 1NF, data may still be repeated even though values are atomic. | In 2NF, repeated data is reduced by separating related data into different tables. | In 3NF, data repetition is further reduced by separating indirectly related data. |
1NF focuses on organizing data into rows and columns properly. | 2NF focuses on the relationship between primary keys and other attributes. | 3NF focuses on keeping each fact in only one place to avoid inconsistency. |
Q11. JavaScript
program to find the smallest of three numbers
<html>
<head>
<title> Smallest among of three numbers</title>
</head>
<body>
<script>
var a = parseInt(prompt("Enter 1st number"));
var b = parseInt(prompt("Enter 2nd number"));
var c = parseInt(prompt("Enter 3rd number"));
if(a<b&&a<c)
{
alert(a+ "is smallest");
}
else if(b<a&&b<c)
{
alert(b+ "is smallest");
}
else
{
alert(c+ "is smallest");
}
</script>
</body>
</html>
OR
Write a PHP script to connect to a MySQL database.
<?php
$servername = "localhost";
$username = "root";
$password = "";
$database = "testdb";
// Create connection
$conn = mysqli_connect($servername, $username,
$password, $database);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Database connected successfully";
?>
Q12. Write short notes on class and inheritance in OOPs with example
Class
·
A
class is a blueprint or template for creating objects.
·
It
contains data members and member functions.
Example:
class
Student
{
int roll;
void display() {}
};
Inheritance
·
Inheritance
allows one class to acquire properties of another class.
·
It
promotes code reusability.
Example:
class
Person {};
class
Student : public Person {};
Requirement Gathering
·
Process
of collecting user needs and expectations before software development.
Methods
1.
Interview – Asking users directly
2.
Questionnaire – Written questions
3.
Observation – Watching users work
4.
Document Analysis – Studying existing systems
5.
Prototyping – Creating sample models
Artificial Intelligence (AI)
AI is the ability of machines to think, learn
and make decisions like humans.
·
Smart
tutoring systems
·
Automated
grading
·
Personalized
learning
·
Virtual
classrooms
·
Chatbots
for student help
GROUP C – Long Answer Questions (2 × 8 = 16)
Transmission Medium
A path through which data is transmitted from
sender to receiver.
A. Guided Media
Uses
physical cables.
1.
Twisted Pair Cable
·
Cheap,
easy to install
·
Low
bandwidth, noise sensitive
2.
Coaxial Cable
·
Better
shielding
·
Moderate
cost
3.
Optical Fiber
·
Very
high speed
·
Expensive,
difficult to install
Uses
wireless signals.
1.
Radio Waves
·
Long
distance
·
Low
security
·
High
speed
·
Line-of-sight
required
3.
Satellite
·
Wide
coverage
·
High
delay
Components of a
Function in C
A
function in C consists of the following main components:
1.
Function Declaration (Prototype)
·
Informs
the compiler about the function name, return type, and parameters.
Example:
int add(int, int);
·
Contains
the actual body of the function where statements are written.
Example:
int add(int a, int b) {
return a + b;
}
·
Used
to invoke or execute the function from `main()` or another function.
Example:
sum = add(5, 10);
·
Sends
a value back to the calling function.
Example:
return result;
·
In
call-by-value, a copy of the actual value is passed to the function.
·
Changes
made inside the function do not affect the original variable.
Example
void
change(int x) {
x = 10;
}
int main() {
int a = 5;
change(a);
printf("%d", a); }
·
In
call-by-reference, the address of the variable is passed to the function.
·
Changes
made inside the function affect the original variable.
·
Actual
parameters are the values passed in the function call.
·
Formal
parameters are the variables used in the function definition.
int
sum(int a, int b) {
return a + b;
}
int result = sum(4, 6);
}
Write
a C program that reads the account_number, name and address of ten customers
from users and displays the account_number, name and address of these customers
using Array and structure.
#include
<stdio.h>
struct
customer {
int account_number;
char name[50];
char address[50];
};
int
main() {
struct customer c[10];
int i;
for(i = 0; i < 10; i++) {
printf("\nEnter details of
customer %d\n", i + 1);
printf("Account Number: ");
scanf("%d",
&c[i].account_number);
printf("Name: ");
scanf("%s", c[i].name);
printf("Address: ");
scanf("%s", c[i].address);
}
printf("\nCustomer Details:\n");
for(i = 0; i < 10; i++) {
printf("\nCustomer %d\n", i +
1);
printf("Account Number:
%d\n", c[i].account_number);
printf("Name: %s\n", c[i].name);
printf("Address: %s\n",
c[i].address);
}
return 0;
}