Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Wednesday, May 17, 2023

NEB Class 12 Hisan Computer Science Model Question Paper Solution

NEB Class 12 Hisan Computer Science Model Question Paper Solution


Grade : XII                                                 Time : 2 hrs

Full Marks: 50 (9 marks Obj+41 Marks Sub)

COMPUTER SCIENCE (4281)



Group "A"

Multiple choice questions [9 x 1=9]

Tick the correct answer.

1. Which of the statements are used in DML statement?
a) Select, drop, update
b) Select, insert, delete
c) Select, drop, delete
d) Select, modify, drop


2. With SQL, how do you select all the records from a table named "student" where the value of column "address" is "Nepal"?
a) Select from student where address is exactly Nepal
b) Select * from student where address is equal to 'Nepal'
c) Select * from student where address ='Nepal'
d) Select * from student where address is not in Nepal


3. What is the last step in the software development lifecycle?
a) System Maintenance
b) System testing
c) Coding
d) System analysis


4. What is the default return type if it is not specified in the function definition?
a) void
b) int
c) float
d) long int




5. What kind of transmission medium is most appropriate for carrying data in a computer network that is exposed to electrical interferences?
a) Unshielded twisted pair
b) Optical fiber
c). Coaxial cable
d) Microwave


6. What should be the correct syntax to write a PHP code?
a) <php>
b) <?php?>
c) <??>
d) Php


7. Which jQuery method is used to hide selected elements?
a) hidden()
b) display(none)
c) hide()
d) visible(false)

8. Which Key is used to link two tables in Mysql?
a) Primary Key
b) Foreign Key
c) Both a. and b
d) None of the mentioned

9. Which is not related to the Internet.
a) UPS
b) TCP/IP
c) WWW
d) ISP

Group "B"

Short answer questions: [5×5=25]

1. Explain INF and 2NF with examples.

Ans: Normalization is the process of organizing data in a database in a structured and efficient manner, reducing redundancy and dependency among data.

INF (First Normal Form): INF requires that each column in a table must be atomic, meaning it should contain only a single value. Each column should also have a unique name, and the order of the rows and columns should not matter. For example:

Consider a table of customer orders:

Order ID

Customer Name

Item Ordered

Quantity

1

Hari Sharma

T-Shirt, Jeans, Shoes

3, 2, 1

2

Bandana Singh

Jacket, Hat

1, 2

3

Rohan Chaudhary

Pants, Socks

2, 5

 
This table is not in INF because the column "Item Ordered" contains multiple values. To bring it to INF, we can split it into separate columns:
 

Order ID

Customer Name

Item 1

Item 2

Item 3

Quantity 1

Quantity 2

Quantity 3

1

Hari Sharma

T-Shirt

Jeans

Shoes

3

2

1

2

Bandana Singh

Jacket

Hat

1

2

3

Rohan Chaudhary

Pants

Socks

2

5



 
2NF (Second Normal Form): 2NF requires that a table should be in INF and also that each non-key column in the table is dependent on the entire primary key. In other words, each non-key column should be related to the primary key, and not just a part of it. For example:
let's consider a table called "Orders" with the following attributes: Order_ID, Customer_ID, Customer_Name, Product_ID, and Product_Name. The primary key is Order_ID and Customer_ID.


Order_ID

Customer_ID

Customer_Name

Product_ID

Product_Name

1

101

Ram

P1

Book

2

102

Shyam

P2

Pen

3

101

Ram

P3

Pencil

 
In this example, the non-key attribute "Customer_Name" depends only on the "Customer_ID" and not on the entire primary key "Order_ID" and "Customer_ID". This indicates a partial dependency and violates 2NF.
To bring the table to 2NF, we can create a new table "Customers" with the attributes "Customer_ID" and "Customer_Name". We can then remove the "Customer_Name" attribute from the "Orders" table, resulting in two tables:
 
Table 1: Customers

Customer_ID

Customer_Name

101

Ram

102

Shyam

 
Table 2: Orders

Order_ID

Customer_ID

Product_ID

Product_Name

1

101

P1

Book

2

102

P2

Pen

3

101

P3

Pencil

 
Now, the table "Orders" is in 2NF, as the non-key attribute "Customer_Name" has been removed and placed in a separate table, avoiding partial dependency.



OR

Demonstrate any three DML statements with examples. [5]

Ans: DML stands for Data Manipulation Language. It is a set of SQL statements that are used to add, change, and delete data in a database. Following are the three statements of DML statements with examples.

i) INSERT statement: This statement is used to insert new data into a table.

Example: Suppose we have a table named "employees" with columns "id", "name", "age", and "salary". To insert a new record into this table, we can use the following SQL statement:

INSERT INTO employees (id, name, age, salary) 
VALUES (101, 'John Doe', 35, 50000);


ii) UPDATE statement: This statement is used to modify existing data in a table.

Example: Suppose we want to update the salary of an employee with id=101 in the employees table. We can use the following SQL statement:

UPDATE employees
SET salary = 55000
WHERE id = 101;

iii) DELETE statement: This statement is used to delete data from a table.

Example: Suppose we want to delete the record of an employee with id=101 from the employees table. We can use the following SQL statement:

DELETE FROM employees
WHERE id = 101;


2. What is OOPs? Explain class, object, and inheritance. [2+3]

OOPs stands for Object-Oriented Programming. It is a programming paradigm based on the concept of "objects", which can contain data, in the form of fields, and code, in the form of procedures or methods. OOPs allows you to break down complex programming problems into smaller, more manageable pieces. 
Following are the features of OOPs.

Class:

A class is a blueprint for an object. It defines the state and behavior of an object. A class can be used to create multiple objects. Each object that is created from a class is an instance of that class.

Object:

An object is a data structure that encapsulates both data and behavior. In other words, an object has both state and behavior. The state of an object is represented by its data, and the behavior of an object is represented by its methods.

Inheritance:

Inheritance is a mechanism in OOP that allows one class to inherit the state and behavior of another class. The class that inherits the state and behavior of another class is called the subclass, and the class that is being inherited from is called the superclass.



3. What do you mean by feasibility study? Why is it necessary before designing a system? [2+3]

Ans: A feasibility study is an assessment of the practicality and potential success of a proposed project or system. It is typically conducted before the design phase of a project to determine whether it is technically feasible, financially viable, and socially acceptable. Feasibility studies may include market research, technical analysis, risk assessment, cost-benefit analysis, and stakeholder consultation. The purpose of a feasibility study is to inform decision-makers about the viability of a project and to identify potential issues and opportunities that may impact its success.

A feasibility study is necessary before designing a system for the following reasons.
  • It can help to save time and money by identifying potential problems early on.
  • It can help to reduce the risk of project failure.
  • It can help to improve the chances of project success.
  • It can help to build consensus and support for the project.
  • It can help to identify and mitigate risks.
  • It can help to develop a realistic project plan.
  • It can help to identify and secure funding.
  • It can help to communicate the project's goals and objectives to stakeholders.


4. What is AI? Explain any two application areas of AI. [1+4]

AI stands for Artificial Intelligence, which refers to the simulation of human intelligence in machines that are programmed to think and act like humans. AI is a broad field that encompasses a range of technologies, including machine learning, natural language processing, computer vision, and robotics.

Following are the two-application area of AI.

Robotics:

Robotics is an interdisciplinary branch of engineering and technology that deals with the design, construction, operation, and application of robots. This field overlaps with computer science, artificial intelligence, mechatronics, electronics, and software engineering.

Robotics is a rapidly growing field with many potential applications. Robots are used in a wide variety of industries, including manufacturing, healthcare, and agriculture. They can also be used to perform dangerous or tedious tasks that are currently done by humans.

Machine learning:

Machine learning is a subset of artificial intelligence that involves building systems that can learn from and make decisions based on data, without being explicitly programmed to do so. It involves training a model or algorithm on a large set of data, and then using that model to make predictions or decisions about new data. Machine learning has many applications, including image and speech recognition, natural language processing, and predictive analytics.


5. Write a function to multiply two numbers in JavaScript.

<!DOCTYPE html>
<html>
<body>
<script>
function multiply(num1, num2) {
return num1 * num2;
}
var result = multiply(5, 10);
document.write("Result: " + result);
</script>
</body>
</html>


OR

Write a PHP program to add two numbers. [5]

<?php

// Get the two numbers from the user

$number1 = readline("Enter the first number: ");

$number2 = readline("Enter the second number: ");

// Add the two numbers together

$sum = $number1 + $number2;

// Display the sum

echo "The sum of the two numbers is: $sum";
?>

Group "C"

Long answer questions:

6. Define IP address. Explain any three different types of IP addresses. [2+6]

Ans: An IP address (Internet Protocol address) is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. IP addresses allow devices to communicate with each other over a network by identifying the source and destination of data packets.

Public IP addresses

Public IP addresses are assigned to devices that are connected to the public internet. Public IP addresses are unique and can be used to identify a specific device on the internet. For example, the public IP address for Google's homepage is 172.217.14.192.

Private IP addresses

Private IP addresses are assigned to devices that are connected to a private network. Private IP addresses are not unique and can be reused on different networks. For example, the private IP address for a home network might be 192.168.1.1. Private IP addresses are not routable on the public internet. This means that they cannot be used to access resources on the public internet, such as websites.

Dynamic IP addresses

Dynamic IP addresses are assigned to devices by a DHCP server. Dynamic IP addresses can change each time a device connects to the network. For example, the dynamic IP address for a laptop might change each time it is connected to a different Wi-Fi network. Dynamic IP addresses are typically used in home and office networks.


7. Define structure. Write a C program to store information of 10 employee' (empid, name, salary) and display it using structure variable. [2+6]

Ans: In C programming language, a structure is a user-defined data type that groups together variables of different data types. It allows you to create a single variable that can hold multiple data items of different data types. The variables inside a structure are called members and can be accessed using the dot (.) operator. Structures are useful for organizing related data items and are commonly used in larger programs to group related data into a single unit.

#include <stdio.h>
// Structure declaration
struct employee {
int empid;
char name[30];
float salary;
};
int main() {
// Declare an array of 10 employee structures
struct employee emp[10];
// Read the employee information from the user
for (int i = 0; i < 10; i++) {
printf("Enter employee %d information:\n", i + 1);
printf("Employee ID: ");
scanf("%d", &emp[i].empid);
printf("Employee Name: ");
scanf("%s", emp[i].name);
printf("Employee Salary: ");
scanf("%f", &emp[i].salary);
}
// Display the employee information
for (int i = 0; i < 10; i++) {
printf("Employee %d\n", i + 1);
printf("Employee ID: %d\n", emp[i].empid);
printf("Employee Name: %s\n", emp[i].name);
printf("Employee Salary: %f\n", emp[i].salary);
}
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>
struct Employee {
int id;
char name[50];
char post[50];
};
int main() {
int i, n;
struct Employee emp[10];
printf("Enter the number of employees: ");
scanf("%d", &n);
// read employee details from user
for(i = 0; i < n; i++) {
printf("Enter details of employee %d:\n", i+1);
printf("ID: ");
scanf("%d", &emp[i].id);
printf("Name: ");
scanf("%s", emp[i].name);
printf("Post: ");
scanf("%s", emp[i].post);
}

// write employee details to file
FILE *fp;
fp = fopen("emp.txt", "w");
for(i = 0; i < n; i++) {
fprintf(fp, "%d %s %s\n", emp[i].id, emp[i].name, emp[i].post);
}
fclose(fp);
// read and display employee details from file
printf("\nEmployee details from file:\n");
fp = fopen("emp.txt", "r");
while(fscanf(fp, "%d %s %s", &emp[i].id, emp[i].name, emp[i].post) != EOF) {
printf("ID: %d\nName: %s\nPost: %s\n\n", emp[i].id, emp[i].name, emp[i].post);
}
fclose(fp);
return 0;
}


Conclusion

In conclusion, the NEB Class 12 Hisan Computer Science exam is a crucial exam for students pursuing a career in computer science. To prepare for the exam, students are given a model question paper that helps them understand the exam pattern and the type of questions that might be asked. By going through the solutions to the model question paper provided in this article, students can gain a better understanding of the concepts and improve their chances of performing well in the exam.

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages