0% found this document useful (0 votes)
8 views19 pages

12model Question

Uploaded by

rabina gurung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views19 pages

12model Question

Uploaded by

rabina gurung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Model Question

2079(2023)

Computer Science

Candidates are required to give their answer in


their own words as far as practicable. The figures in
the margin indicate full marks.
Time: -2 hrs.

Full Marks: - 50

Group A
Rewrite the correct options of each question
in your answer sheet. (9x1=9)

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
Correct Answer is Option D (Que no 7)

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

Short Answer Questions

10. Which type of database system


(centralized or distributed) is mostly
preferred by financial institution like a bank?
Give any four suitable reasons.

Solution: Financial institutions like banks prefer a


centralized database system. Here are five reasons
why financial institutions like banks typically prefer
centralized database systems:

1.Data Security: Financial institutions deal with


sensitive information such as customer financial
records, transaction histories, and personal
information. A centralized database system
provides a single point of control, making it
easier to secure and protect sensitive
information from unauthorized access, fraud,
and cyber-attacks.
2.Data Integrity: A centralized database system
ensures that data is consistent and accurate. It
eliminates the possibility of data inconsistencies
that can arise with multiple copies of data in a
distributed database system.
3.Regulatory Compliance: Financial institutions
are subject to strict regulatory requirements. A
centralized database system can make it easier
to manage compliance, maintain records, and
provide audit trails for regulatory purposes.
4.Scalability: Centralized database systems can
scale to handle large volumes of data and high
transaction volumes, which is important for
financial institutions that need to support many
customers and transactions.
5.Operational Efficiency: A centralized
database system can simplify data
management and maintenance, reducing the
need for multiple administrators and IT staff.
This can result in cost savings and improved
operational efficiency.

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.

Solution: Relational databases are widely used by


business organizations due to their several
advantages. Here are some reasons why business
organizations prefer applying relational model for
database design:
1. Flexibility: Relational databases are flexible
because the data is stored in tables that can be
easily joined together via a primary key or a
foreign key.
2. Scalability: Relational databases can handle
large amounts of data and can be easily scaled
to meet the changing requirements of a
business.
3. Ease of use: Relational databases are easy to
use and understand, and they provide a simple
and intuitive way to organize and access data.
4. Data integrity: Relational databases enforce
data integrity by ensuring that data is
consistent and accurate across all tables.

11. Develop a program in JavaScript to


exchange/swap the values of any two
variables.

Solution: The JavaScript program to


exchange/swap the values of any two variables is:

<html>

<head>

<title> JavaScript program to exchange/swap the


values of any two variables</title>

</head>

<body>

<script>

let a = 5;

let b = 10;

console.log("Before swap: a =", a, "and b =", b);

let temp = a;

a = b;
b = temp;

console.log("After swap: a =", a, "and b =", b);

</script>

</body>

</html>

OR

How can you connect a database with PHP?


Demonstrate with an example.

Solution:
To connect MySQL database with PHP, you can use
the following steps:
(1)Create a new PHP file and write the following
code to establish a connection with MySQL:

<?php

$servername = "localhost";

$username = "your_username";

$password = "your_password";

$dbname = "your_database_name";
$conn = mysqli_connect($servername, $username,
$password, $dbname);

if (!$conn) {

die("Connection failed: " . mysqli_connect_error());

echo "Connected successfully";

?>

(2) Replace "your_username", "your_password", and


"your_database_name" with your actual MySQL
username, password, and database name.
(3) Save the PHP file and run it in a web browser. If
the connection is successful, you should see the
message "Connected successfully" displayed in the
browser.

12. Describe the concept of Object Oriented


and Procedure Oriented Programming in brief.

Solution:
Object oriented programming is a programming
paradigm that was developed to overcome the
drawbacks and limitations of particularly procedure-
oriented programming. The major need for
developing such languages was to manage the
ever-increasing size and complexity of programs.
Procedural programming is a programming
paradigm that organizes software design around
procedures. Procedures are self-contained units of
code that perform a specific task. Procedural
programming is based on the concept of "functions"
that take inputs and produce outputs. Functions are
called by other functions to perform tasks.
The main difference between OOP and procedural
programming is their approach to code
organization. In procedural programming, the
program is divided into small parts called functions.
In OOP, the program is divided into small parts
called objects. Procedural programming follows a
top-down approach while OOP follows a bottom-up
approach.

13. Write down any five qualities of good


software.

Solution: Good software is characterized by


several key attributes. Here are five qualities of
good software:
1. Functionality: The software meets the
requirements and specifications that it was
designed for, and it behaves as expected when
it is used in its intended environment.
2. Usability: The software is easy to use and
understand, and it provides a positive user
experience.
3. Reliability: The software is free of defects and
it performs consistently and accurately under
different conditions and scenarios.
4. Performance: The software runs efficiently and
quickly, and it can handle large amounts of data
or traffic.
5. Security: The software is protected against
unauthorized access and it keeps the data and
functions safe from malicious attacks.

14. Explain mobile computing with its


advantages and disadvantages.

Solution: Mobile computing is the form of human-


computer interaction by which a computer is
expected to be transported during normal usages.
Mobile computing is a generic term describing one's
ability to use technology while moving, as opposed
to portable which is the only particle for use while
deployed in a stationary configuration.
Advantages
1. Increase in Productivity- Mobile devices can
be used out in the field of various companies,
therefore reducing the time and cost for clients
and themselves.
2. Entertainment- Mobile devices can be used for
entertainment purposes, for personal and even
for presentations to people and clients.
3. Portability- This would be one of the main
advantages of mobile computing, you are not
restricted to one location for you to get jobs
done or even access email on the go.
4. Cloud Computing- This service is available for
saving documents on a online server and being
able to access them anytime and anywhere
when you have a connection to the internet and
can access these files on several mobile devices
or even PCs at home.
5. Quick Service- We can sell a product or give
service in quicker time by using mobile
computing.
6. Social Interactivity – it is very useful tool for
social interactivity that allows for data sharing
and collaboration between users.

Disadvantages

1. Quality of connectivity- as one of the


disadvantages, mobile devices will need either
WiFi connectivity or mobile network
connectivity such as GPRS, 3G and in some
countries even 4G connectivity that is why this
is a disadvantage because if you are not near
any of these connections your access to the
internet is very limited.
2. Security concerns- Mobile VPNs are unsafe to
connect to, and also syncing devices might also
lead to security concerns.
3. Power Consumption- due to the use of
batteries in these devices, these do not tend to
last long, if in a situation where there is no
source of power for charging then that will
certainly be a letdown.
4. Human interface with device- These are still
uncommon; screens are often too small.
Keyboards are impractical, especially one
handed.

Group C
Give the long answers to the following
questions.

15. Why do most of the business


organizations prefer setting their network
with the client-server architecture? Write its
advantages and disadvantages.

Solution:
Client-server architecture is a type of computer
network architecture where many clients (remote
processors) request and receive service from a
centralized server (host computer). Many business
organizations prefer setting their network with the
client-server architecture due to its several
advantages. Here are some advantages and
disadvantages of client-server architecture:

Advantages:

1. Centralization: The main advantage of client-


server network is the centralized control that it
is integrated with. All the necessary information
is placed in a single location.
2. Security: In client-server network, the data is
well protected due to its centralized
architecture. It can be enforced with access
controls such that only authorized users are
granted access.
3. Scalability: Client-server networks are highly
scalable. Whenever the user needs they can
increase the number of resources such as
clients and servers.
4. Management: Since all the files are stored in
the central server, it is rather easy to manage
files.

Disadvantages:

1. Cost: Setting up a client-server network can be


expensive as it requires specialized hardware
and software.
2. Maintenance: Maintaining a client-server
network can be complex and may require
dedicated IT staff.
3. Single point of failure: Since all data and
services are centralized on the server, if the
server fails, all clients will be affected.

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].

Solution:

#include <stdio.h>

struct student {

int roll_number;

char name[50];
int sub1;

int sub2;

int sub3;

};

int main() {

struct student s[12];

int i;

// input student data

for (i = 0; i < 12; i++) {

printf("Enter Roll Number, Name, Sub1 marks,


Sub2 marks, Sub3 marks of student %d:\n", i+1);

scanf("%d %s %d %d %d", &s[i].roll_number,


s[i].name, &s[i].sub1, &s[i].sub2, &s[i].sub3);

// print student data

printf("\nRoll No.\tName\t\tSub1\tSub2\tSub3\
tTotal\tPercentage\n");
for (i = 0; i < 12; i++) {

int total = s[i].sub1 + s[i].sub2 + s[i].sub3;

float percentage = (float)total / 3;

printf("%d\t\t%s\t\t%d\t%d\t%d\t%d\t%.2f%%\n",
s[i].roll_number, s[i].name, s[i].sub1, s[i].sub2,
s[i].sub3, total, 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.

Solution:

#include <stdio.h>

#include <stdlib.h>
struct student {

int reg_no;

char name[50];

char gender;

char address[100];

};

int main() {

FILE *fp;

struct student s;

char another;

fp = fopen("score.dat", "wb");

if (fp == NULL) {

printf("Error opening file.\n");

exit(1);

}
do {

printf("Enter student information:\n");

printf("Reg_no: ");

scanf("%d", &s.reg_no);

printf("Name: ");

scanf("%s", s.name);

printf("Gender (M/F): ");

scanf(" %c", &s.gender);

printf("Address: ");

scanf("%s", s.address);

fwrite(&s, sizeof(s), 1, fp);

printf("\nAdd another record (Y/N)? ");

scanf(" %c", &another);

} while (another == 'Y' || another == 'y');

fclose(fp);

fp = fopen("score.dat", "rb");

if (fp == NULL) {
printf("Error opening file.\n");

exit(1);

printf("\nDisplaying student information:\n");

while (fread(&s, sizeof(s), 1, fp) == 1) {

printf("\nReg_no: %d\n", s.reg_no);

printf("Name: %s\n", s.name);

printf("Gender: %c\n", s.gender);

printf("Address: %s\n", s.address);

fclose(fp);

return 0;

You might also like