NEB Class 12 Computer Model Question Paper 2080 With Solution
Grade: 12 Sub: Computer Science
Time: 2 hrs. Full Marks: 50
Candidates are requested to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
Group A
1. In which normal form of database, atomicity is introduced?
A) First
B) Second
C) Third
D) Fourth
2. Which of the following techniques is not implemented to protect a database?
A) Rollback
B) Backup
C) Recovery
D) Firewall
3. Which one of the following SQL commands is executed to display all the records having a second letter in the LNAME (LAST NAME) as “A” from the customer table?
A) SELECT * FROM CUSTOMER WHERE LNAME LIKE “?A%”;
B) SELECT * FROM CUSTOMER WHERE LNAME LIKE “_A%”;
C) SELECT * FROM CUSTOMER WHERE LNAME LIKE “A%”;
D) SELECT * FROM CUSTOMER WHERE LNAME LIKE “%A”;
4. Which of the following is an incorrect IP address?
A) 192.168.0.1
B) 192.168.1
C) 172.255.0.0
D) 202.10.79.4
5. Which of the following is a server-side scripting language?
A) JavaScript
B) MySql
C) PHP
D) Jquery
6. Which of the following keywords are used to declare a variable in JavaScript?
A) int or var
B) float or let
C) var or let
D) char or var
7. Which of the following commands is executed in PHP to concatenate the variables $x with $y?
A) $x + $y
B) $x=$y
C) concat ($x,$y)
D) $x.$y
8. Which statement is incorrect about the object-oriented approach?
A) Emphasis is on data rather than procedure.
B) Data is hidden and cannot be accessed.
C) Objects communicate through functions.
D) It supports abstract data but not the class.
9. Which of the following feasibility study is concerned with cost-benefit analysis?
A) Technical feasibility
B) Economic feasibility
C) Operational feasibility
D) Schedule feasibility
11. Develop a program in JavaScript to exchange/swap the values of any two variables.
Ans:
<!DOCTYPE html>
<html>
<head>
<title>Variable Swapping</title>
</head>
<body>
<h1>Variable Swapping Example</h1>
<p>Open the console to view the original and swapped values.</p>
<script>
//initialize variables
let a = 5;
let b = 10;
//display original values
document.write("<p>Original values:</p>");
document.write("<p>a = " + a + "</p>");
document.write("<p>b = " + b + "</p>");
//swap values
let temp = a;
a = b;
b = temp;
//display swapped values
document.write("<p>Swapped values:</p>");
document.write("<p>a = " + a + "</p>");
document.write("<p>b = " + b + "</p>");
</script>
</body>
</html>
OR
How can you connect a database with PHP? Demonstrate with an example.
Ans:
<?php
echo "Welcome to the stage where we are ready to get connected to a database <br>";
// Connecting to the Database
$servername = "localhost";
$username = "root";
$password = "";
// Create a connection
$conn = mysqli_connect($servername, $username, $password);
// Die if connection was not successful
if (!$conn){
die("Sorry we failed to connect: ". mysqli_connect_error());
}
else{
echo "Connection was successful";
}
?>
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fptr;
char filename[] = "score.dat";
char choice;
int reg_no;
char name[50], gender[10], address[100];
// open file in write mode (w+)
fptr = fopen(filename, "w+");
if (fptr == NULL) {
printf("Error opening file.");
exit(1);
}
do {
// get student details from user
printf("Enter Registration Number: ");
scanf("%d", ®_no);
printf("Enter Name: ");
scanf("%s", name);
printf("Enter Gender: ");
scanf("%s", gender);
printf("Enter Address: ");
scanf("%s", address);
// write details to file
fprintf(fptr, "%d %s %s %s\n", reg_no, name, gender, address);
printf("Do you want to enter details of another student? (y/n): ");
scanf(" %c", &choice);
} while (choice == 'y' || choice == 'Y');
// close file
fclose(fptr);
// display contents of file
printf("\nDetails of all students:\n");
fptr = fopen(filename, "r");
if (fptr == NULL) {
printf("Error opening file.");
exit(1);
}
while (fscanf(fptr, "%d %s %s %s\n", ®_no, name, gender, address) != EOF) {
printf("Registration Number: %d\n", reg_no);
printf("Name: %s\n", name);
printf("Gender: %s\n", gender);
printf("Address: %s\n", address);
printf("-----------------------------\n");
}
fclose(fptr);
return 0;
}
A) 192.168.0.1
B) 192.168.1
C) 172.255.0.0
D) 202.10.79.4
5. Which of the following is a server-side scripting language?
A) JavaScript
B) MySql
C) PHP
D) Jquery
6. Which of the following keywords are used to declare a variable in JavaScript?
A) int or var
B) float or let
C) var or let
D) char or var
7. Which of the following commands is executed in PHP to concatenate the variables $x with $y?
A) $x + $y
B) $x=$y
C) concat ($x,$y)
D) $x.$y
8. Which statement is incorrect about the object-oriented approach?
A) Emphasis is on data rather than procedure.
B) Data is hidden and cannot be accessed.
C) Objects communicate through functions.
D) It supports abstract data but not the class.
9. Which of the following feasibility study is concerned with cost-benefit analysis?
A) Technical feasibility
B) Economic feasibility
C) Operational feasibility
D) Schedule feasibility
Group B
Give short answer of the following questions. (5×5=25)
10. Which type of database system (centralized or distributed) is mostly preferred by a financial institution like a bank? Give any four suitable reasons.
Ans: Financial institutions like banks typically prefer centralized database systems over distributed database systems. Here are four reasons:
i) Data consistency and integrity: Centralized database systems provide better data consistency and integrity because all data is stored in a single location, making it easier to maintain and ensure that all data is accurate and up-to-date.
ii) Enhanced security: Centralized database systems are easier to secure because there is only one location that needs to be protected. This makes it easier to monitor access, prevent unauthorized access, and maintain backups of critical data.
iii) Better performance: Centralized database systems typically provide better performance because all data is stored in one place, making it easier to retrieve and process data quickly. This can be especially important for financial institutions that need to process transactions quickly and efficiently.
iv) Easier management: Centralized database systems are easier to manage because there is only one location to maintain, update, and troubleshoot. This makes it easier to ensure that all systems are up-to-date, secure, and working properly.
Overall, a centralized database system provides financial institutions with better data consistency and integrity, enhanced security, better performance, and easier management, making it the preferred choice for many banks and other financial institutions.
OR
Nowadays most of the business organizations prefer applying relational model for database design in comparison to other models. Justify the statement with your arguments.
Ans: The relational model is widely preferred by business organizations for database design over other models for the following reasons:
i) Data consistency: The relational model ensures data consistency through normalization, which reduces data redundancy and eliminates data inconsistencies. This leads to more accurate and reliable data for decision-making.
ii) Query flexibility: The relational model allows for complex queries that can join multiple tables, filter data, and aggregate results. This allows organizations to extract valuable insights from their data and make more informed decisions.
iii) Scalability: The relational model is highly scalable, allowing organizations to add or remove data as needed without affecting the overall structure of the database. This makes it easier to accommodate growth and change within the organization.
iv) Standardization: The relational model has become the industry standard for database design, meaning that many third-party tools and applications are designed to work with it. This makes it easier to integrate data from different sources and share data between different systems.
v) Security: The relational model provides a high level of security, with features such as user authentication, access control, and encryption. This helps to protect sensitive data from unauthorized access or theft.
Overall, the relational model provides a flexible, scalable, and standardized approach to database design that is well-suited to the needs of modern business organizations. Its ability to ensure data consistency, enable complex queries, and provide robust security make it the preferred choice for many organizations.
Ans:
<!DOCTYPE html>
<html>
<head>
<title>Variable Swapping</title>
</head>
<body>
<h1>Variable Swapping Example</h1>
<p>Open the console to view the original and swapped values.</p>
<script>
//initialize variables
let a = 5;
let b = 10;
//display original values
document.write("<p>Original values:</p>");
document.write("<p>a = " + a + "</p>");
document.write("<p>b = " + b + "</p>");
//swap values
let temp = a;
a = b;
b = temp;
//display swapped values
document.write("<p>Swapped values:</p>");
document.write("<p>a = " + a + "</p>");
document.write("<p>b = " + b + "</p>");
</script>
</body>
</html>
OR
How can you connect a database with PHP? Demonstrate with an example.
Ans:
<?php
echo "Welcome to the stage where we are ready to get connected to a database <br>";
// Connecting to the Database
$servername = "localhost";
$username = "root";
$password = "";
// Create a connection
$conn = mysqli_connect($servername, $username, $password);
// Die if connection was not successful
if (!$conn){
die("Sorry we failed to connect: ". mysqli_connect_error());
}
else{
echo "Connection was successful";
}
?>
12. Describe the concept of Object Oriented and Procedure Oriented Programming in brief.
Ans: Object-oriented programming (OOP) and procedure-oriented programming (POP) are two different approaches to programming.
Procedure-oriented programming (POP) is a traditional approach to programming that focuses on breaking down a program into a series of functions or procedures. In POP, the emphasis is on the procedures that are executed to manipulate data. The data is usually stored in a set of global variables that can be accessed by any procedure in the program. POP is good for smaller programs that don't need to be updated frequently.
Object-oriented programming (OOP) is a newer approach to programming that focuses on objects rather than procedures. In OOP, data and the procedures that manipulate it are combined into a single unit called an object. An object is an instance of a class, which is a blueprint for creating objects. The class defines the properties and methods that an object can have. OOP is good for larger programs that require frequent updates and maintenance.
The main difference between POP and OOP is that in POP, data and procedures are separate, while in OOP, they are combined into objects. This makes OOP more modular and easier to update and maintain. OOP also provides encapsulation, which means that data is hidden from other objects and can only be accessed through the methods of the object. This makes OOP more secure than POP.
In summary, POP is a traditional approach to programming that focuses on procedures, while OOP is a newer approach that focuses on objects. OOP is more modular, easier to update and maintain, and provides encapsulation, making it more secure than POP.
13. Write down any five qualities of good software.
Ans: There are several qualities that make software good. Here are five of them:
i) Reliability: Good software is reliable, meaning that it performs its intended functions accurately and consistently. It should not fail or crash frequently, and it should be able to recover from errors gracefully.
ii) Maintainability: Good software is maintainable, meaning that it is easy to update, modify, and add new features to. This requires good documentation, well-organized code, and clear design patterns.
iii) Usability: Good software is usable, meaning that it is easy for users to learn and operate. It should have a clear and intuitive user interface, and it should be designed with the user's needs and goals in mind.
iv) Performance: Good software is performant, meaning that it runs efficiently and quickly, even when processing large amounts of data or handling complex tasks.
v) Security: Good software is secure, meaning that it protects user data and prevents unauthorized access or malicious attacks. This requires good encryption, authentication, and access control mechanisms.
14. Explain mobile computing with its advantages and disadvantages.
Ans: Mobile computing refers to the use of portable computing devices such as smartphones, tablets, and laptops to access and use information on the go. These devices are connected to a wireless network, allowing users to access the internet and other network resources from anywhere.
Advantages of mobile computing:
- Portability: The main advantage of mobile computing is that it allows users to access information from anywhere, anytime. Users can work remotely, access files, and stay connected on the go.
- Increased productivity: Mobile computing can increase productivity by allowing users to work on the go, eliminating the need to be tied to a specific location or device.
- Cost savings: Mobile computing can save businesses money by reducing the need for physical office space and travel expenses.
- Improved communication: Mobile computing allows for real-time communication and collaboration among team members, regardless of location.
Disadvantages of mobile computing:
- Security concerns: Mobile devices can be lost or stolen, making them vulnerable to security breaches and data theft.
- Compatibility issues: Not all applications and software are compatible with mobile devices, which can limit the functionality of these devices.
- Battery life: Mobile devices often have limited battery life, requiring users to carry chargers or backup batteries to ensure they stay connected.
- Distractions: Mobile computing can be a distraction, as users may be tempted to check their devices during meetings or in other settings where it's not appropriate.
Group C
Give a long answer to the following question. (2×8=16)
15. Why do most of business organizations prefer setting their network with the client-server architecture? Write its advantages and disadvantages.
Ans: Most business organizations prefer setting up their network with the client-server architecture because it provides a centralized and secure approach to data management. In a client-server architecture, the server is responsible for managing data and resources, while clients access these resources from the server.
Advantages of client-server architecture:
- Centralized data management: All data is stored and managed on the server, which makes it easier to manage and secure.
- Scalability: Client-server architecture is easily scalable as the network can be expanded by adding more servers or clients.
- Enhanced security: Client-server architecture provides better security by centralizing data management and controlling access to resources.
- Efficient resource utilization: Resources can be shared among multiple clients, reducing the overall cost of hardware and software.
Disadvantages of client-server architecture:
- Cost: Client-server architecture can be expensive to set up and maintain due to the need for dedicated servers and specialized software.
- Single point of failure: The server is a single point of failure, and if it fails, the entire network may go down.
- Network congestion: If the network is not properly designed or managed, it can result in network congestion and slow performance.
- Complexity: Client-server architecture can be complex and require specialized knowledge to set up and manage.
16. Develop a program in C using structure to ask the information of any 12 students with roll_number, name and marks scored in sub1, sub2, and sub3. Also, display them in proper format along with the calculation of total and percentage. [Note: the full marks of each subject is 100].
Ans:
#include<stdio.h>
#include<string.h>
struct student{
int roll_number;
char name[50];
int sub1, sub2, sub3;
float total, percentage;
};
int main(){
struct student s[12];
int i;
printf("Enter information of 12 students:\n");
for(i=0;i<12;i++){
printf("\nStudent %d:\n",i+1);
printf("Enter Roll Number: ");
scanf("%d",&s[i].roll_number);
printf("Enter Name: ");
scanf("%s",s[i].name);
printf("Enter marks in Subject 1: ");
scanf("%d",&s[i].sub1);
printf("Enter marks in Subject 2: ");
scanf("%d",&s[i].sub2);
printf("Enter marks in Subject 3: ");
scanf("%d",&s[i].sub3);
s[i].total=s[i].sub1+s[i].sub2+s[i].sub3;
s[i].percentage=(s[i].total/300)*100;
}
printf("\nDisplaying Information of 12 students:\n");
for(i=0;i<12;i++){
printf("\nStudent %d:\n",i+1);
printf("Roll Number: %d\n",s[i].roll_number);
printf("Name: %s\n",s[i].name);
printf("Marks in Subject 1: %d\n",s[i].sub1);
printf("Marks in Subject 2: %d\n",s[i].sub2);
printf("Marks in Subject 3: %d\n",s[i].sub3);
printf("Total Marks: %.2f\n",s[i].total);
printf("Percentage: %.2f%%\n",s[i].percentage);
}
return 0;
}
OR
Demonstrate a program in C to create a data file named score.dat to store students’ information with Reg_no, name, gender, and address. The program should ask the user to continue or not. When finished, the program should also display all the records in the proper format.
Ans:
#include <stdlib.h>
int main()
{
FILE *fptr;
char filename[] = "score.dat";
char choice;
int reg_no;
char name[50], gender[10], address[100];
// open file in write mode (w+)
fptr = fopen(filename, "w+");
if (fptr == NULL) {
printf("Error opening file.");
exit(1);
}
do {
// get student details from user
printf("Enter Registration Number: ");
scanf("%d", ®_no);
printf("Enter Name: ");
scanf("%s", name);
printf("Enter Gender: ");
scanf("%s", gender);
printf("Enter Address: ");
scanf("%s", address);
// write details to file
fprintf(fptr, "%d %s %s %s\n", reg_no, name, gender, address);
printf("Do you want to enter details of another student? (y/n): ");
scanf(" %c", &choice);
} while (choice == 'y' || choice == 'Y');
// close file
fclose(fptr);
// display contents of file
printf("\nDetails of all students:\n");
fptr = fopen(filename, "r");
if (fptr == NULL) {
printf("Error opening file.");
exit(1);
}
while (fscanf(fptr, "%d %s %s %s\n", ®_no, name, gender, address) != EOF) {
printf("Registration Number: %d\n", reg_no);
printf("Name: %s\n", name);
printf("Gender: %s\n", gender);
printf("Address: %s\n", address);
printf("-----------------------------\n");
}
fclose(fptr);
return 0;
}
You may also read:
No comments:
Post a Comment