Saturday, April 12, 2025

[SOLUTION] HERALD Pre-Board Examination - 2081 (2025)

HERALD Pre-Board Examination - 2081
Grade: XII (Science)
Subject: Computer Science (4281)

 

Group 'A'

Multiple Choice Questions                                                                                          [9×1=9]

  1. Which SQL keyword is used to retrieve data from a table?
    a) SELECT
    b) WHERE
    c) FROM
    d) JOIN

Note: The SELECT keyword is used to query data from a table in SQL.

  1. Which of the following techniques is used to grant privileges to users in a database?
    a) Authentication
    b) Authorization
    c) Isolation
    d) Backup

Note: Authorization is the process of granting specific privileges or permissions to users in a database, allowing them access to certain resources.

  1. Which JavaScript function is used for input?
    a) alert()
    b) prompt()
    c) confirm()
    d) console.log()

Note: The prompt() function in JavaScript is used to take input from the user through a dialog box.

  1. What is the type of inheritance shown in the following figure?

a) Single inheritance
b) Multilevel inheritance
c) Hierarchical inheritance
d) Multiple inheritance

Note: Multilevel inheritance occurs when a class inherits from another class, and that class is derived from another class, forming a hierarchy.

  1. System Requirement Specification (SRS) document is used in which stage of software development?
    a) Planning
    b) Analysis
    c) Development
    d) Testing

Note: The System Requirement Specification (SRS) document is produced in the analysis phase of software development, detailing the functional and non-functional requirements.

  1. What is not a service of cloud computing?
    a) SaaS
    b) PaaS
    c) IaaS
    d) NaaS

Note: NaaS (Network as a Service) is not considered a standard service in cloud computing, while SaaS, PaaS, and IaaS are widely recognized models.

  1. Data is represented in bits in which layer of the OSI model?
    a) Physical
    b) Data link
    c) Network
    d) Presentation

Note: Data is represented in bits at the physical layer of the OSI model, which is responsible for transmitting raw data over physical connections.

  1. Which of the functions is used to read a character from a file?
    a) getc()
    b) getch()
    c) getchar()
    d) putc()

Note: The getc() function is used in C to read a single character from a file.

  1. How many modes of communication are there?
    a) 1
    b) 2
    c) 3
    d) 4

Note: There are three modes of communication: unidirectional(simplex), bidirectional(half-duplex), and multidirectional(full-duplex). These modes describe how data is transmitted between parties.

 

Group 'B'

Short answer questions:                                                                            [5 x 5 = 25]

10.   Explain about 2NF and 3NF with example.

OR

What are DDL and DML statements? Write with example queries.

  1. What is event handling? How do you add an event handler in JavaScript? Give an example.

Ans:

In JavaScript, an event handler is a function that gets executed when a specific event occurs, such as a mouse click, a key press, or a form submission. We can add event handlers using either of the following methods:

a) Using the onclick attribute (Inline event handling)

b) Using addEventListener() (External event handling)

A simple example of an event handler using the onclick attribute in JavaScript is as follows:

<!DOCTYPE html>

<html>

<head>

    <title>Hello World</title>

</head>

<body>

<button onclick="showMessage()">Click me</button> 

    <script>

        function showMessage()

        {

            document.write("Hello, World!");

        }

 </script>

</body>

</html>

Explanation:

The showMessage() function uses document.write() to directly write the text "Hello, World!" to the page.

(Click me) button triggers the showMessage() function when clicked

 

OR

Define the syntax of database connectivity in PHP. Write a server-side scripting code to insert data into the table 'student' having fields (first name, last name and marks). Assume that server name="localhost", username="root", password="", database name="student".

Ans:

Syntax for Database Connectivity:

$con = new mysqli($servername, $username, $password, $database);

OR

$con = mysqli_connect($servername, $username, $password, $database);

 

A server-side scripting code to insert data into the table student having fields (first name, last name and marks) is as follows:

<?php

// Step 1: Database configuration

$servername = "localhost";

$username = "root";

$password = "";

$database = "student";

 

//Step2: Database connection

$con = new mysqli($servername, $username, $password, $database);

 

// Step 3: Check connection

if ($con->connect_error)

{

    die("Connection failed: " . $con->connect_error);

} else {

    echo "Connected successfully!";

}

 

// Step 4: Prepare the SQL statement for insertion

$sql = "INSERT INTO student (first_name, last_name, mark)

             VALUES ('Madhav', 'Sapkota', 30)";

 

// Step 5: Execute the query and check if data is inserted

if ($con->query($sql) === TRUE)

{

    echo "Data inserted successfully";

} else {

    echo "Error: " . $sql . "<br>" . $con->error;

}

// Step 6: Close connection

$con->close();

?>

 

  1. Explain about the big data with its features.

Ans:

Big Data is a term that describes extremely large and complex datasets that traditional data processing methods can't handle efficiently. It covers data that is characterized by high volume, high velocity, and high variety, often requiring advanced techniques and technologies to analyze and extract meaningful information. Some examples of Big Data are as follows:

a) Social media data (Facebook, Twitter, Instagram)

b) E-commerce transactions (Amazon, Flipkart)

c) Healthcare records (EHRs, MRI scans)

d) Banking and financial transactions

e) IoT sensor data (smart cities, wearables)

f) Search engine data (Google, Bing), etc.

Features of big data are as follows:

a) Volume: Enormous amounts of data are generated every day from various sources.

b) Velocity: Data is generated and processed rapidly, requiring real-time or near-real-time analysis.

c) Variety: Data comes in diverse formats, including structured, unstructured, and semi-structured data.

d) Veracity: The accuracy and reliability of data are crucial for meaningful analysis.

e) Value: Extracting valuable insights from big data can drive informed decision-making and business growth.

 

  1. Write about the features of OOPS.

Ans:

Object-Oriented Programming (OOP) is a programming paradigm based on the concept of objects, which contain both data (attributes) and methods (functions).

Some characteristics(features) of OOP are as follows:

1) Class:

A class is a blueprint or template for creating objects. It defines a set of properties (attributes) and methods (functions) that the objects created from the class will have.

2) Object:

An object is an instance of a class. It is a specific realization of a class with actual values for the properties defined by the class. Objects can interact with one another through methods, making them the building blocks of an application.

3) Polymorphism:

Polymorphism refers the ability of an object to take on different forms depending upon situations. The same method(function) can behave differently on different classes.

4) Inheritance: In Object-Oriented Programming (OOP), inheritance is a fundamental concept that allows a class (called a subclass or derived class) to inherit properties and behaviours (methods and attributes) from another class (called a superclass or base class).

5) Encapsulation:

Encapsulation is a fundamental concept in Object-Oriented Programming (OOP) that involves wrapping(bundling) data (attributes) and methods (functions) into a single unit (class) and hides the internal details from the outside world.

6) Abstraction:

Abstraction involves hiding the complex implementation details and showing only the essential features of the object.

 

  1. Explain the prototype model of software development with a clear diagram.

Ans:

The Prototype Model is a software development model in which a working prototype (an early sample or incomplete version of the final product) is built, tested, and improved based on user feedback, before the final system is developed. This model is especially useful when the requirements of the system are not well understood from the beginning.

Key Phases of the Prototype Model are as follows:

1.       Requirements Gathering: Basic system requirements are gathered from the client.

2.       Quick Design: A basic layout/UI or conceptual design is made to show how the system might look.

3.       Build Prototype: A functional but limited version of the software is built.

4.       Customer Evaluation of Prototype: The prototype is shown to the customer.

5.       Refine Requirements Incorporating Customer Suggestions: Feedback from the customer is used to improve the prototype.

This loop continues until the customer is satisfied and approves the prototype.

 

Group 'C'

Long answer questions:                                                                                          [8 x 2 = 16]

       15. What is network topology? Explain any three topologies with their merits and demerits.

  1. Define a user-defined function with an example. Write a program to test if a number is prime or composite.

Ans:

#include <stdio.h>

#include <conio.h>

void check(int);

void main() {

    int a;

    clrscr();

    printf("Enter a number: ");

    scanf("%d", &a);

    check(a);

    getch();

}

void check(int x)

{

    int i, count = 0;

    if (x <= 1)

    {

        printf("%d is neither PRIME nor COMPOSITE", x);

        return;

    }

    for (i = 1; i <= x; i++)

    {

        if (x % i == 0)

            count++;

    }

    if (count == 2)

        printf("%d is a PRIME number", x);

    else

        printf("%d is a COMPOSITE number", x);

}

 

OR

What is a file? Write about the modes of operation in file handling? WAP that writes into a file named myfile.docx character wise.

Ans:

A file is a collection of related data stored on a disk. It allows data to be saved permanently so it can be accessed and processed later, even after the program is closed. In C programming, file handling enables reading from and writing to files using a set of standard library functions.

There are mainly six modes, these modes are used with the fopen() function, which opens a file and returns a pointer to that file.

The various file handling (opening) modes in C are as follows:

1)      "r" mode (Read): "r" mode opens an existing file for the purpose of reading only. The possible operation is reading from the file.

2)      "w" mode (Write): "w" mode opens a file for the purpose of writing only. The possible operation is writing to the file.

3)      "a" mode (Append): "a" mode opens an existing file for the purpose of appending (i.e., adding new information at the end of file).

4)      "r+" mode (Read + Write): "r+" mode opens an existing file for the purpose of both reading and writing.

5)      "w+" mode (Write + Read): "w+" mode opens a file for the purpose of both writing and reading.

6)      "a+" mode (Append + Read): "a+" mode opens an existing file for the purpose of both reading and appending.

A program that writes into a file named myfile.docx character wise are as follows:

#include<stdio.h>

#include<conio.h>

void main()

{

  char name[20];

  int rn, age;

  FILE *fptr;

  clrscr();

  fptr=fopen("myfile.docx","w");

  printf("Enter name:");

  scanf("%s",name);

  printf("Enter rollno:");

  scanf("%d",&rn);

  printf("Enter age:");

  scanf("%d",&age);

  fprintf(fptr,"\n%s\t%d\t%d",name,rn,age);

  fclose(fptr);

  getch();

}

 

 

 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home