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’
Re-write the correct options of each question in your answer sheet.
(9×1=9)
1. Which of the following is used to display the output in PHP?
a) echo b) write c) print
d) Both (a)
and (c)
2. The primary key does not accept …….
a) Text b) Number c) Null value
d) None of the above
3. TCP is a commonly used protocol at
(a) Application layer (b) Transport layer
(c) Network layer (d) Data link layer
4. A table named product(pid, pname, price) contains records. To fetch all
records in SQL we use 5
(a) SELECT * FROM
product;
(b) DISPLAY all;
(c) PRINT all from product;
(d) PRINT * from product;
5. What will be the output of following JavaScript code? <script>
var string1="40";
var intvalue=50;
alert(string1+intvalue);
</script>
a) 40 b) 50 c) 4050 d) 40 50
6. The ____________ determines whether the project should go forward.
(a) Feasibility
assessment
(b) opportunity identification
(c) system evaluation
(d) program specification
7. Which of the following is a technology that is commonly used in virtual reality
(VR) systems?
(a) Artificial
intelligence (AI)
(b) Mobile computing
(c) Augmented reality (AR)
(d) Natural language processing (NLP)
8. Which software prevents external access to a system?
(a) Firewall (b)
Gateway (c) Router (d) Antivirus Virus checker
9. Which of the following is the way in which an IoT device is associated with
data?
(a) Internet (b)
Cloud (c)Automata (d) Network
Group ‘B’
Give short answer of the following questions.
(5×5=25)
10. Explain normalization with its advantages.
Give an example of 1NF. (3+2)
Ans: Normalization is a process of
organizing data in a database in a structured way to eliminate redundancy and
ensure data consistency. It involves breaking down a database into
smaller, more manageable tables and defining relationships between them to
minimize data duplication. Normalization helps to reduce data anomalies,
improve data quality, and make the database more scalable and flexible.
Advantages of Normalization:
i) Improved data quality
ii) Reduced data redundancy
iii) Better database design
iv) Reduced data anomalies
Example of 1NF:
First Normal Form (1NF) is a level of database
normalization that requires all data in a table to be atomic. Atomicity means
that each cell in a table should contain a single, indivisible value and not a
list or a set of values. This ensures that each row in a table represents a
single instance of an entity and that each column in a table represents a
single attribute of that entity.
Let's consider an example to understand 1NF.Suppose we have a table of
employees as follows:
Consider a table named "Customers" with the following
attributes:
|
CustomerID |
Name |
Phone Numbers |
|
001 |
Ram |
123456789, 987654321 |
|
002 |
Sita |
555555555, 666666666, 777777777 |
In this example, the
"Phone Numbers" attribute contains multiple phone numbers separated
by a comma, which violates the 1NF rule because it is not atomic. To normalize
this table to 1NF, we need to separate the repeating group of phone numbers into
a separate table and establish a relationship between them.
So, we can create a new
table named "PhoneNumbers" with the attributes CustomerID and
PhoneNumber, and remove the "Phone Numbers" attribute from the
"Customers" table. The "Customers" table would now have the
following attributes:
|
CustomerID |
Name |
|
001 |
Ram |
|
002 |
sita |
And, the
"PhoneNumbers" table would have the following attributes:
|
CustomerID |
PhoneNumber |
|
001 |
123456789 |
|
001 |
987654321 |
|
002 |
555555555 |
|
002 |
666666666 |
|
002 |
777777777 |
OR
What
is DBMS? Explain the benefits and limitations of a centralized database system.
(1+4)
Ans:
DBMS stands for Database Management System. It is a software system that allows
users to create, modify, and manage databases. A DBMS provides a way to store
and organize data in a structured and secure manner, making it easier to access
and manage data for multiple users and applications.
Common examples of DBMSs include Ms-Access, Oracle, MySQL, Microsoft SQL
Server, and PostgreSQL.
Benefits of
centralized database system:
Ø Improved data consistency and accuracy
Ø Improved security and access control
Ø Simplified backup and recovery procedures
Ø Reduced data redundancy and storage requirements
Ø Reduced costs of managing multiple databases
Ø Dependency on a single database server
Ø Limited availability and accessibility
Ø Increased network traffic and latency
Ø Reduced data privacy and confidentiality
Ø High cost of maintenance and upgrades
Ø Increased risk of data loss or corruption due to system failures.
11. Write a JavaScript program to check
whether the given number is odd or even. (5)
Ans:
<html>
<head>
<title>javascript
if</title>
<body>
<script>
let num = prompt("Enter a
number: ");
if (num % 2 === 0) {
alert(num + " is even.");
}
else {
alert(num + " is odd.");
}
</script>
</body>
</html>
(Using Function in JS)
<html>
<head>
<title></title>
<body>
<script>
// Define a function to check
whether a number is odd or even
function checkOddOrEven(number) {
if (number % 2 === 0) {
return number + " is an even
number.";
} else {
return number + " is an odd
number.";
}
}
// Prompt the user to input a
number and pass it to the checkOddOrEven() function
let inputNumber =
parseInt(prompt("Enter a number: "));
let result = checkOddOrEven(inputNumber);
// Display the result in an alert
box
alert(result);
</script>
</body>
</html>
OR
Write
PHP code to create SQL database with server-side scripting. (5)
<?php
$servername = "localhost";
$username = "root";
$password = "";
// Create connection
$conn = new mysqli($servername,
$username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: "
. $conn->connect_error);
}
// Create database
$sql = "CREATE DATABASE
myDB";
if ($conn->query($sql) === TRUE)
{
echo "Database created
successfully";
} else {
echo "Error creating database:
" . $conn->error;
}
$conn->close();
?>
12.
What is OOP? List its features and explain any one of them. (1+1+3)
Ø Abstraction
Ø Inheritance
Ø Polymorphism
Ø Class
Abstraction:
13. What is a software development model? Explain about prototype model. (1+4)
Prototype
Model:
Ø Early feedback from stakeholders can identify issues before they become major problems.
Ø Iterative nature allows for continuous refinement of the software, leading to a better final product.
Ø Helps to reduce development time and cost by identifying issues early in the development life cycle.
Demerits:
Ø Can be difficult to manage changes to the software during the iterative process.
Ø May require more resources and time for development and testing.
Ø Not suitable for projects with fixed or rigid requirements.
Group
‘C’
Ø Easy to set up and requires less cabling
than other topologies.
Ø Well suited for small networks.
Ø Inexpensive compared to other topologies.
Ø Can become slow when many devices are
connected to the network.
Ø If the bus fails, the entire network
fails.
Ø Limited distance coverage, and any issues
with the cable can cause the entire network to malfunction.
Ø Failure of one device does not affect the entire network.
Ø Easy to add or remove devices without affecting the rest of the network.
Ø Centralized management makes troubleshooting and maintenance easier.
Disadvantages:
- Requires more cabling than a bus topology.
- Failure of the central hub or switch will result in the failure of the entire network.
- The cost of the central hub or switch can be higher compared to a bus topology.
- No collisions in the network as only one device can transmit at a time.
- Good for high-performance networks that need to transmit large amounts of data quickly.
Disadvantages:
- Failure of one device can break the ring and cause the entire network to fail.
- Adding or removing devices from the network can be difficult.
- Troubleshooting issues in a ring topology can be more challenging than in other topologies.
16.
Write a C program to store registration number , name and marks of 5 students
using structure and display them in descending order on the basis of marks. (8)
Ans:
#include <stdio.h>
#include <string.h>
struct student {
int rno;
char name[50];
int marks;
} s[5];
int main() {
int i, j;
struct student temp;
// Input registration number, name,
and marks of 5 students
for (i = 0; i < 5; i++) {
printf("\nEnter registration
number, name, and marks of student %d:\n", i+1);
scanf("%d %s %d",
&s[i].rno, s[i].name, &s[i].marks);
}
// Sort the students in descending
order based on marks
for (i = 0; i < 5; i++) {
for (j = i+1; j < 5; j++) {
if (s[i].marks < s[j].marks) {
temp = s[i];
s[i] = s[j];
s[j] = temp;
}
}
}
// Display the sorted list of
students
printf("\n\nRegistration
Number\tName\tMarks\n");
for (i = 0; i < 5; i++) {
printf("%d\t\t\t%s\t%d\n",
s[i].rno, s[i].name, s[i].marks);
}
return 0;
}
OR
Write a program in C to create a data file “score.txt” which stores Student ID,
Name, marks of computer until user press yes. After that display all the
records of file “score.txt”. (4+4)
#include <stdio.h>
int main()
{
FILE *fptr;
int id, marks;
char name[50], choice;
// Open the file for writing and
reading in truncate mode
fptr = fopen("score.txt",
"w+");
do
{
// Input student ID, name, and marks
printf("Enter student ID,
name, and marks for the computer subject:\n");
scanf("%d %s %d",
&id, name, &marks);
// Write the student record to the
file
fprintf(fptr, "%d %s
%d\n", id, name, marks);
// Ask user to input more records
printf("Do you want to enter
more records? (y/n): ");
scanf(" %c", &choice);
} while (choice == 'y' || choice ==
'Y');
// Rewind the file to the beginning
rewind(fptr);
// Display all records in the file
printf("\nStudent
Records:\n\n");
printf("ID\tName\t\tMarks\n");
while (fscanf(fptr, "%d %s
%d", &id, name, &marks) == 3) {
printf("%d\t%s\t\t%d\n",
id, name, marks);
}
// Close the file
fclose(fptr);
return 0;
}
إرسال تعليق