Monday, August 19, 2024

Set 5: SOLVED PABSON 2080(Karnali/Sudurpaschim) COMPUTER SCIENCE 2081

 


Set 5: PABSON 2080(Karnali/Sudurpaschim)

 

Opt. II Computer Science

Time : 2 hours                                                                                                                       Full Marks: 50

Candidates are required to give their answer according to the given instructions.

Attempt all questions.

Group 'A

1. Answer the following questions in one sentence:

 

a)     What do you mean by primary key?

Ans: A primary key is a field or combination of fields in a table that uniquely identifies each record, and is used to establish relationships between tables and enforce data integrity.

 

b)    What is a database? Give example.

Ans: A collection of systematically organized inter-related data  which store, organize and retrieve data is called a database. E.g. Dictionary, Marks Ledger etc.

 

c)     Define cyber ethics.

Ans: Cyber ethics is a set of moral principles or code of conducts that regulate the use of computers systematically without making harm to other users.

 

d)    Write any two keywords used in C-programming.

Ans: Any two keywords used in C-programming  are int, return.

 

e)     What do you mean by B2C model of e-commerce?

Ans: The B2C (Business-to-Consumer) model involves businesses selling products or services directly to consumers online.

 

f)      What is the function of INT() in QBASIC programming?

Ans: The INT() function in QBASIC returns the integer portion of a number by removing the decimal part.

 

2. Write appropriate technical term for the following:

a. The device that is used to connect two networks with different communication protocols. Gateway

b. A person who breaks computer security and uses a computer and file present in it. Hacker

 

3. Write the full form of the following:

a. VOIP - Voice Over Internet Protocol

b. WLAN - Wireless Local Area Network

 

Group 'B'

4. Answer the following questions:

 

a.     What is computer network architecture? Mention its types.

Ans: Computer network architecture defines how the computer communicates and interacts with each other on network. Types include Centralized, Peer-to-Peer (P2P) and Client-Server architectures.

 

b.     What do you mean by digital signature? Why it is important?

Ans: A digital signature is an encrypted code attached to an electronic document, verifying the sender's identity. It is important because it ensures the authenticity and integrity of a document.

 

c.      What is a firewall? Enlist the types of firewall.

Ans: A firewall is a security system that monitors and controls incoming and outgoing network traffic.

Types of firewall are:

Network-Based Firewall: This type of firewall protects an entire network. It’s like a big wall around a city, guarding all the computers in that network from outside threats. It is usually placed where the network connects to the internet.

Host-Based Firewall: This type of firewall protects a single computer. It’s like a personal security guard for your computer, checking all the data that comes in and out of it.

 

 

d.     Differentiate between computerized and non- computerized databases.

Ans:

Computerized Database

Non-Computerized Database

It can store large volume of data.

It is limited by physical storage available.

We can search data very easily.

It can take a while to manually search through all of the records.

 

e.      What is Al? Enlist two application areas of Al.

Ans: Artificial intelligence (AI) is an area of computer science that emphasizes the creation of intelligent machines that work and reacts like humans.

Application areas include Natural Language Processing and Robotics.

 

f.      What is hardware security? Enlist any two measures to protect it.

Ans: Hardware security refers to the protection of physical devices from damage, theft, or unauthorized access. Measures include regular maintenance and insurance.

 

g.     What is field property in Ms-Access? Enlist any four of them.

Ans: Field properties in MS-Access define the characteristics and behavior of fields in a table. Examples: Field Size, Format, Default Value, Validation Rule.

 

h.     What is Indexing? Why form and report are used in MS-Access?

Ans: Indexing is a field property which speeds up searching and sorting of records based on a field.

Forms are used to easily enter, view, and edit data in the database. They provide a user-friendly way to interact with the data.

Reports are used to present data in a structured and printable format. They allow us to create professional-looking documents that summarize and display the information stored in the database.

 

i.       What is Query ? Write the types of Action Query .

Ans: Query is an object of database that is used to view, retrieve, change and analyze records from a table or multiple linked tables based on specified condition.

Types of Action Queries include Update, Append, Delete, and Make-Table.

 

5. Write the output of the given program. (workout with a dry-run table)

DECLARE SUB Show ( )

CLS

CALL Show

END

SUB Show

C=3

B=2

FOR I = 2 TO 8 STEP 2

PRINT C;

SWAP B, C

B = C + 1

NEXT I

END SUB

 

Dry Run Table

B

C

FOR I = 2 TO 8 STEP 2

PRINT C;

SWAP B, C

B=C+1

2

3

2 to 8 step 2 yes

3

B=3, C=2

2+1=3

3

2

4 to 8 step 2 yes

2

B=2, C=3

3+1=4

4

3

6 to 8 step 2 yes

3

B=3, C=4

4+1=5

5

4

8 to 8 step 2 yes

4

B=4, C=5

5+1=6

6

5

10 to 8 step 2 no

Loop Exits

 

 

 

 

The output of the program is:

3  2  3  4

 

6. Rewrite the given program after correcting bugs:

REM To add a few records in the existing data file

CLS

OPEN "emp.dat" FOR OUTPUT AS #2

DO

INPUT "Enter Employee Name, Post, Salar”; :EN$, POST$, SALARY

PRINT #2, EN$, POST$, SALARY

INPUT “ADD MORE RECORDS (Y/N)?”; C

LOOP WHILE LICASE$(C$)=”Y”

CLOSE #1

END

 

Debugged Program

REM To add a few records in the existing data file

CLS

OPEN "emp.dat" FOR APPEND AS #2

DO

    INPUT "Enter Employee Name, Post, Salary: "; EN$, POST$, SALARY

    PRINT #2, EN$, POST$, SALARY

    INPUT "ADD MORE RECORDS (Y/N)? "; C$

LOOP WHILE UCASE$(C$) = "Y"

CLOSE #2

END

 

7. Study the following program and answer the given questions:

DECLARE FUNCTION SUM(N)

CLS

INPUT “Enter a number"; N

X=SUM(N)

PRINT “The sum of individual digits is"; X

END

FUNCTION SUM(N)

WHILEN<>0

R=N MOD 10

S=S+R

N=INT(N/10)

WEND

SUM=S

END FUNCTION

a. Name the user defined function in the above program.

Ans:  SUM ( ) is the user defined function in the above program.

b. How many times the WHILE WEND loop repeats If the value of Nis 1234?

Ans:  4 times the WHILE WEND loop repeats If the value of N is 1234.

 

Group C

Calculate or convert as per the instructions.

 

(CA)16 = (?)10

 

= (12 × 16¹) + (10 × 16⁰)

=12×16 + 10 × 1

=192+10

=202

(CA)16 = (202)10

 

(652)10 = (?)8

 

Divide by the base 8 to get the digits from the remainders:

Division
by 8

Quotient

Remainder

(Digit)

Digit #

(652)/8

81

4

0

(81)/8

10

1

1

(10)/8

1

2

2

(1)/8

0

1

3

= (1214)8

(652)10 = (1214)8

 

(10101)2 x  (11)2 - (1110)2

 

 

 

 

1

0

1

0

1

 

 

 

 

 

x

1

1

 

 

 

1

0

1

0

1

 

 

1

0

1

0

1

X

 

 

1

1

1

1

1

1

 

 

 

 

1

1

1

0

 

 

1

1

0

0

0

1

 

(10101)2 x  (11)2 - (1110)2 = (110001)2

 

(111011)2 / (100)2

 

100)

1

1

1

0

1

1

(1110

 

1

0

0

 

 

 

 

 

 

1

1

0

 

 

 

 

 

1

0

0

 

 

 

 

 

 

1

0

1

 

 

 

 

 

1

0

0

 

 

 

 

 

 

 

1

1

 

 

 

 

 

 

 

0

 

 

 

 

 

 

1

1

 

 

            Q = 1110

            R = 11

 

9 a. Write a program in QBASIC to input a radius, create a user defined function to calculate the volume of hemisphere and total surface area (TSA) of the sphere using sub procedure.

DECLARE SUB CalcSphere(R)

INPUT "Enter Radius: "; R

CALL CalcSphere(R)

END

 

SUB CalcSphere(R)

    V = (2/3) * 3.14159 * R^3

    TSA = 4 * 3.14159 * R^2

    PRINT "Volume of Hemisphere = "; V

    PRINT "Total Surface Area of Sphere = "; TSA

END SUB

 

 

b A sequential data file "record.dat” contains the name, address, salary of employees, and displays the record of those whose salary is more than 37000 and whose name ends with "DHA.

 

OPEN "record.dat" FOR INPUT AS #1

DO WHILE NOT EOF(1)

    INPUT #1, NAME$, ADDR$, SALARY

    IF SALARY > 37000 AND RIGHT$(NAME$, 3) = "DHA" THEN

        PRINT NAME$, ADDR$, SALARY

    END IF

LOOP

CLOSE #1

END

 

10. Write a C program to input a character and check whether it is vowel or consonant.                   (4)

#include <stdio.h>

 

int main() {

    char ch;

    printf("Enter a character: ");

    scanf("%c", &ch);

 

    if (ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U' ||

        ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {

        printf("%c is a vowel.\n", ch);

    } else {

        printf("%c is a consonant.\n", ch);

    }

 

    return 0;

}

 

 

 

OR

Write a program in C 'language' to input a number and check whether it is a palindrome or not.      [4]

#include <stdio.h>

 

int main() {

    int n, reversed = 0, original, remainder;

    printf("Enter an integer: ");

    scanf("%d", &n);

 

    original = n;

 

    while (n != 0) {

        remainder = n % 10;

        reversed = reversed * 10 + remainder;

        n /= 10;

    }

 

    if (original == reversed) {

        printf("%d is a palindrome.\n", original);

    } else {

        printf("%d is not a palindrome.\n", original);

    }

 

    return 0;

}