Model Question
School Leaving Certificate Examination (2078)
Subject: Computer Science |
Grade: Grade XII |
Full Marks: 50 |
Time: 2 Hours |
Group A: Multiple Choice Questions (9 x 1=9)
Tick the correct answer.
1. Which of the statements are used in DDL?
A) Create, alter and drop
B) Create, insert and select
C) Insert, update and delete
D) Delete, alter and drop
2. With SQL, how do you select all the records from
a table named “Persons” where the value
of the column “FirstName” ends with an “a”?
A) SELECT * FROM Persons WHERE FirstName=‟a‟
B) SELECT * FROM Persons WHERE FirstName LIKE „a%‟
C) SELECT * FROM Persons WHERE FirstName
LIKE „%a‟
D) SELECT * FROM Persons WHERE FirstName=‟%a%‟
3. Which of the following statements is true about a
star network topology?
A) Each device is connected to a switch
or hub
B) Each device is connected to each other
C) Each device is connected in a trunk
D) Each device is connected to a terminal
4. Which of the following is the correct syntax to
display "Stay Safe" in an alert box using
JavaScript?
A) alert-box("Stay Safe");
B) confirm("Stay Safe");
C) msgbox("Stay safe");
D) alert("Stay Safe");
5. What is the use of <A> tag?
A) To insert an image
B) To create a link
C) To create a hyperlink
D) To create a list
6. What is the output of given C program?
void main(){
char str1[] = "FIRST"; char str2[20];
strcpy(str2,str1);
printf("%s %s ",str1,str2);
printf("%d", (str1!=str2));
printf("%d", strcmp(str1,str2)); }
A) FIRST FIRST 0 0
B) FIRST FIRST 1 1
C) FIRST FIRST 1 0
D) FIRST FIRST 0 1
7. Where is a class derived in inheritance?
A) Superclass
B) Subclass
C) Subsetclass
D) Relativeclass
8. Which of these is the correct order of the SDLC?
A) Analysis, Design, Coding, Testing,
Implementation
B) Analysis, Design, Testing, Implementation, Coding
C) Implementation, Coding, Analysis, Design, Testing
D) Design, Testing, Implementation, Coding, Analysis
9. Why is cloud computing popular nowadays?
A) Cost-sharing and easily accessible
B) As modern technology and costly
C) Accessible and freely available
D) Affordable to all
Group
B: Short Answer Questions (5 x 5=25)
1. Explain 2NF and 3NF
with examples.
In database normalization, the second normal form
(2NF) and third normal form (3NF) are used to further reduce redundancy and
improve the integrity of the data.
2NF is a database normalization technique that is
applied to a relationship that is already in the first normal form (1NF). A relation is
in 1NF if it satisfies the following two conditions:
i) The relation has no repeating groups.
ii) Each attribute has a unique name.
A relation is in 2NF if it is in 1NF and satisfies
the following additional condition:
Every non-key attribute is fully dependent on the
primary key.
In other words, a relation is in 2NF if it has no
partial dependencies, i.e., if the value of a non-key attribute depends on only
a part of the primary key.
For example, consider the following relation:
StudentID |
CourseID |
InstructorID |
Grade |
1 |
1 |
1 |
A |
1 |
2 |
2 |
B |
2 |
1 |
1 |
C |
2 |
2 |
2 |
D |
This relation is in 1NF because it has no repeating groups and each attribute has a unique name. However, it is not in 2NF because the Grade attribute is not fully dependent on the primary key, which is the combination of StudentID and CourseID. In other words, the value of Grade depends on both StudentID and CourseID, but also on InstructorID. To make this relation 2NF, we can split it into two relations:
Students
StudentID |
1 |
2 |
Enrollments
StudentID |
CourseID |
InstructorID |
Grade |
1 |
1 |
1 |
A |
1 |
2 |
2 |
B |
2 |
1 |
1 |
C |
2 |
2 |
2 |
D |
Now, the Enrollments relation is in 2NF because the Grade attribute is fully dependent on the primary key, which is the combination of StudentID and CourseID.
3NF is a database normalization technique that is
applied to a relation that is already in 2NF. A relation is in 3NF if it is in
2NF and satisfies the following additional condition:
Every non-key attribute is non-transitively
dependent on the primary key.
In other words, a relation is in 3NF if it has no
transitive dependencies, i.e., if the value of a non-key attribute depends on
another non-key attribute.
For example, consider the following relation:
EmployeeID |
DepartmentID |
ManagerID |
Salary |
1 |
1 |
2 |
1000 |
2 |
1 |
3 |
2000 |
3 |
1 |
3 |
3000 |
4 |
2 |
3 |
4000 |
This relation is in 1NF and 2NF because it has no repeating groups, each attribute has a unique name, and every non-key attribute is fully dependent on the primary key. However, it is not in 3NF
OR
Demonstrate the basic DML statement with an example.
Ans: DML (Data Modification Language) statements are
used to modify the data stored in a database. Here are some examples of basic
DML statements:
INSERT statement: This statement is used to insert
new rows into a table.
INSERT INTO students (name, age, major) VALUES
('John', 22, 'Computer Science');
UPDATE statement: This statement is used to modify
the data in existing rows of a table.
UPDATE students SET major = 'Electrical Engineering'
WHERE name = 'John';
DELETE statement: This statement is used to delete
rows from a table.
DELETE FROM students WHERE age < 18;
SELECT statement: This statement is used to retrieve
data from a table.
SELECT * FROM students;
2. Write a function to add any two numbers in
Javascript.
Ans:
<!DOCTYPE html>
<html>
<head>
<script>
function sum(a, b){
var c = a+b;
return c;
}
alert(sum(5,3));
</script>
</head>
<body>
</body>
</html>
OR
Demonstrate the external CSS implemented in the web page.
To implement external CSS in a web page, you need to
create a separate CSS file and link to it from the HTML file.
Create a file called style.css and add your CSS
rules to it. For example:
body {
background-color: lightblue;
}
h1 {
color: navy;
}
In HTML file,
use the <link> element to link to the CSS file. You should place this
element in the <head> section of your HTML file.
<head>
<link
rel="stylesheet" href="style.css">
</head>
This will apply the styles defined in style.css to
your web page.
3. Describe any five
features of OOPs.
Object-oriented
programming (OOP) is a programming paradigm that is based on the concept of
"objects", which can contain data and code that manipulates that
data. Here are five key features of OOP:
i) Encapsulation: This
refers to the bundling of data and methods that operate on that data within a
single unit, or object. Encapsulation helps to protect the data from external
access or modification.
ii) Abstraction: This
refers to the ability to focus on the essential features of an object and
ignore the non-essential details. Abstraction helps to simplify complex systems
and make them more manageable.
iii) Inheritance: This
refers to the ability of a class to inherit properties and methods from a
parent class. Inheritance allows you to create a new class that is a modified
version of an existing class, without having to rewrite all of the code in the
new class.
iv) Polymorphism: This
refers to the ability of a class to take on multiple forms. Polymorphism allows
you to create a single interface to various implementations of an object.
v) Overloading: This
refers to the ability of a class to have multiple methods with the same name,
but with different parameters. Overloading allows you to create methods with
the same name that perform different tasks, depending on the number or type of
arguments passed to them.
4. What are the different stages of software
planning? Describe.
Software planning is
the process of defining the goals, objectives, and steps involved in creating a
software product. It is an important part of the software development process,
as it helps to ensure that the final product meets the needs of the users and
the stakeholders. Here are the different stages of software planning:
i) Requirements
gathering: This is the first stage of software planning, and it involves
collecting information about the needs and requirements of the users and
stakeholders. This may involve conducting interviews, surveys, or focus groups
to gather data about the desired features and functionality of the software.
ii) Scope definition:
This stage involves defining the boundaries of the software project, including
the features and functionality that will be included, as well as those that
will be excluded. This helps to establish clear expectations and avoid scope
creep, which can cause the project to become too large and complex.
iii) Feasibility
analysis: This stage involves evaluating the technical and financial
feasibility of the project. This may include assessing the available resources,
such as budget, personnel, and hardware, to determine whether the project is
realistic and achievable.
iv) Design: This stage
involves creating a detailed plan for the structure and functionality of the
software. This may involve creating diagrams, flowcharts, and other technical
documentation to describe how the software will work.
v) Implementation: This
is the stage where the software is actually developed. This may involve writing
code, building interfaces, and testing the software to ensure that it meets the
requirements and functions correctly.
vi) Deployment: This is
the final stage of software planning, and it involves installing and
configuring the software for use by the end users. This may involve setting up
servers, creating user accounts, and providing training and support to ensure
that the software is used effectively.
5. Define the concept of AI and IoT.
AI (Artificial
Intelligence) refers to the ability of computers and other machines to perform tasks
that would normally require human intelligence, such as recognizing patterns,
learning from experience, and making decisions. AI algorithms can be trained to
perform a wide range of tasks, including image and speech recognition, language
translation, and decision-making.
IoT (Internet of
Things) refers to the interconnected network of physical devices, vehicles,
buildings, and other objects that are embedded with sensors, software, and
network connectivity, allowing them to collect and exchange data. The IoT
allows these objects to be connected and controlled remotely, and to
communicate with each other and with humans.
AI and IoT are often
used together, as AI algorithms can be used to analyze the data collected by
IoT devices and make intelligent decisions based on that data. For example, an
IoT-enabled thermostat might use AI to learn the temperature preferences of a
user and adjust the temperature accordingly, or an IoT-enabled security camera
might use AI to recognize faces and alert the owner if an unauthorized person
is detected.
Group C: Long Answer
Questions (2 x 8=16)
6. How do you implement the Class C IP address in the local area network? Describe.
To implement a Class C IP address in a local area
network (LAN), you will need to follow these steps:
i) Determine the subnet
mask for the Class C IP address. A Class C IP address has a default subnet mask
of 255.255.255.0.
ii) Assign the IP
address and subnet mask to each device on the LAN. This can be done manually by
configuring the network settings on each device, or it can be done
automatically using a DHCP server.
iii) Configure the
router or network gateway to use the Class C IP address as the default gateway.
This will allow devices on the LAN to communicate with devices on other
networks, such as the Internet.
iv) Test the network
connectivity by pinging a device on the LAN from another device. This will help
to ensure that the IP addresses and subnet mask are configured correctly and
that the devices can communicate with each other.
7. Write a program to enter ten integer numbers into an array, sort and display them in ascending order.
#include <stdio.h>
main()
{
// define an
array with 10 elements
int
numbers[10];
// prompt
the user to enter 10 integer numbers
for (int i =
0; i < 10; i++)
{
printf("Enter a number: ");
scanf("%d", &numbers[i]);
}
// sort the array in ascending order
for (int i =
0; i < 9; i++)
{
for (int j
= i + 1; j < 10; j++)
{
if
(numbers[i] > numbers[j]) {
int
temp = numbers[i];
numbers[i] = numbers[j];
numbers[j] = temp;
}
}
}
// print the
sorted array
for (int i =
0; i < 10; i++)
{
printf("%d ", numbers[i]);
}
printf("\n");
}
OR
Write a program to read the marks of any 5 students
in a subject and count how many
students are pass and fail.
#include <stdio.h>
main()
{
// define an
array to store the marks of 5 students
int
marks[5];
// read the
marks of 5 students
for (int i =
0; i < 5; i++)
{
printf("Enter the marks of student %d: ", i + 1);
scanf("%d", &marks[i]);
}
// count the
number of students who have passed and failed
int num_pass
= 0;
int num_fail
= 0;
for (int i =
0; i < 5; i++)
{
if
(marks[i] >= 40)
{
num_pass++;
} else {
num_fail++;
}
}
// print the
results
printf("Number of students who have passed: %d\n", num_pass);
printf("Number of students who have failed: %d\n", num_fail);
}
No comments:
Post a Comment