HSLC Computer Science Practical Question Paper 2024
1. Type HTML5 code for any one of the following:
a) Create two linked web pages. The first web page should have an image of an object of your choice that must be linked to another page. The second document should have information on the project ‘object by your choice’.
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>First Web Page</title>
</head>
<body>
<h1>Welcome to My First Web Page!</h1>
<p>Click on the image below to learn more about the object.</p>
<a href=”second_page.html”><img src=”object_image.jpg” alt=”Object”></a>
</body>
</html>
b) Using the concept of tables, create a web page displaying your class timetable.
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Class Timetable</title>
<style>
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h2>Class Timetable</h2>
<table>
<tr>
<th>Time</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
</tr>
<tr>
<td>8:00 AM – 9:00 AM</td>
<td>Math</td>
<td>English</td>
<td>Science</td>
<td>Social Science</td>
<td>Computer Science</td>
</tr>
<tr>
<td>9:00 AM – 10:00 AM</td>
<td>Computer Science</td>
<td>Assamese</td>
<td>Math</td>
<td>English</td>
<td>Math</td>
</tr>
</table>
</body>
</html>
2. Type C program code for any one of the following:
a) A C program to extract the individual digits from a given integer.
Ans:
#include <stdio.h>
int main() {
int num;
printf(“Enter an integer: “);
scanf(“%d”, &num);
printf(“Individual digits: “);
while (num != 0) {
int digit = num % 10;
printf(“%d “, digit);
num /= 10;
}
return 0;
}
b) A C program to find the summation of digits of a given integer.
Ans:
#include <stdio.h>
int main() {
int num, sum = 0, remainder;
printf(“Enter an integer: “);
scanf(“%d”, &num);
while (num != 0) {
remainder = num % 10; // Get the rightmost digit
sum += remainder; // Add the digit to sum
num = num / 10; // Remove the rightmost digit
}
printf(“Sum of digits: %d\n”, sum);
return 0;
}
3. Type MySQL query for the following:
a) Create a table ‘sales’ in a database with your first name with the following fields:
Column Name | Data type | Size | Constraints |
SalesmanNo | CHAR | 4 | Primary key |
SalesmanName | VAR CHAR | 15 | Not null |
Date of Joining | DATE | — | — |
SalesZone | CHAR | 5 | — |
SalesAmount | INT | — | Not null |
Ans:
CREATE TABLE sales (
SalesmanNo CHAR(4) PRIMARY KEY,
SalesmanName VARCHAR(15) NOT NULL,
DateOfJoining DATE,
SalesZone CHAR(5),
SalesAmount INT NOT NULL
);
b) Insert data into the table as follows:
Salesman No | SalesmanName | Date of Joining | SalesZone | SalesAmount |
S001 | Rahul Sharma | 2011-01-01 | EAST | 4,00,000 |
S002 | Aryan Barua | 2016-05-02 | NORTH | 2,80,000 |
S003 | Pallab Goswami | 2014-03-01 | SOUTH | 3,50,000 |
S004 | Jatin Deka | 2018-02-28 | NORTH | 2,00,000 |
S005 | Soumya Nath | 2017-06-05 | EAST | 2,50,000 |
S006 | Sourav Sharma | 2015-07-04 | WEST | 3,00,000 |
Ans:
INSERT INTO sales (SalesmanNo, SalesmanName, DateOfJoining, SalesZone, SalesAmount)
VALUES
(‘S001’, ‘Rahul Sharma’, ‘2011-01-01’, ‘EAST’, 400000),
(‘S002’, ‘Aryan Barua’, ‘2016-05-02’, ‘NORTH’, 280000),
(‘S003’, ‘Pallab Goswami’, ‘2014-03-01’, ‘SOUTH’, 350000),
(‘S004’, ‘Jatin Deka’, ‘2018-02-28’, ‘NORTH’, 200000),
(‘S005’, ‘Soumya Nath’, ‘2017-06-05’, ‘EAST’, 250000),
(‘S006’, ‘Sourav Sharma’, ‘2015-07-04’, ‘WEST’, 300000);
c) Type a query for the following (any three):
(i) Display SalesmanNo and SalesmanName of each record.
Ans:
SELECT SalesmanNo, SalesmanName
FROM sales;
(ii) Display SalesmanNo and SalesmanName of East Zone.
Ans:
SELECT SalesmanNo, SalesmanName
FROM sales
WHERE SalesZone = ‘EAST’;
(iii) Display the records having SalesAmount in the range 2,00,000 to 3,50,000.
Ans:
SELECT *
FROM sales
WHERE SalesAmount BETWEEN 200000 AND 350000;
(iv) Display the maximum and minimum SalesAmount
Ans:
SELECT MAX(SalesAmount) AS MaximumSalesAmount, MIN(SalesAmount) AS MinimumSalesAmount
FROM sales;
4. Viva voce.
1 thought on “HSLC Computer Science Practical Question Paper”