Monday, August 19, 2024

Set 1: SOLVED PABSON 2080 (KOSHI) SEE COMPUTER SCIENCE

 





Set 1: SOLVED PABSON 2080 (KOSHI)

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: [6x1=6]

 

a)     Write the different modes of communication.

Ans: The different modes of communication are simplex, half duplex and full duplex.

 

b)    What to loT?

Ans: IoT (Internet of Things) refers to the network of interconnected devices that communicate and exchange data via the internet.

 

c)     List the different LAN topology.

Ans: The different LAN topologies are bus, star and ring topology.

 

d)    What is Global Variable in QBasic?

Ans: A global variable is a variable that is declared outside any function and is accessible from any part of the program.

 

e)     What is tuple?

Ans: A tuple is a row in a table which contains information about single items in a database.

 

f)      Write any two data types used in C-language.

Ans: The two data types used in C language are int and float.

 

2.Write appropriate technical term for the following:

 

a)     Sending and receiving messages electronically through the Internet. Email (Electronic Mail)

b)     Services provided by the government to public via electronic media especially using Internet.

E-Governance (Electronic Governance)

 

3. Write the full form of the following:

 

a)     FTP - File Transfer Protocol

b)     B2B - Business to Business

 

4. Answer the following questions

 

a)     What is computer network? Write any two advantages of computer network.

Ans: Computer network is a group of two or more computers and devices connected to each other through wired or wireless media to exchange data and information and share hardware, software and other resources.

Any two advantages of computer network are:

A network connected computers can share hardware devices such as scanner, printer, hard disk, etc.

It can communicate and share information all over the world through Internet.

 

 

 

 

b)    List any four areas where Al can help us.

Ans: Any four areas where Al can help us

·       Robotics – AI is used in robotics to control robots and make them perform task autonomously.

·       Gaming - The AI machines can play strategic games like chess, where the machine needs to think of a large number of possible places.

·       Natural Language Processing − It is possible to interact with the computer that understands natural language spoken by humans.

·       Security - AI is used in facial recognition, threat detection, and cybersecurity

 

c)     What is digital Footprint? Write any two points to reduce the size of digital footprint while using internet.

Ans: A digital footprint is the trail of data left behind by users on the internet.

any two points to reduce the size of digital footprint while using internet are:

- avoid sharing personal information publicly

- regularly delete unused accounts.

 

d)    Mention the benefits and limitations of E-commerce .

Ans: The benefits and limitations of E-commerce are:

Advantages of E-commerce

·       Faster buying/selling procedure, as well as easy to find products.

·       There are no geographical limitations, can deliver service globally.

Disadvantages of E-commerce

·       Lack of personal touch. We cannot touch the goods physically.

·       We cannot do any transaction without Internet access device. So, it is heavily dependent on Internet technologies

 

e)     Define Encryption and Decryption.

Ans: Encryption is the process of converting data into a coded form to prevent unauthorized access. Decryption is the process of converting the coded data back into its original form.

 

f)      What is RDBMS? Write any two examples

Ans: RDBMS (Relational Database Management System) is a database management system based on a relational model. Examples: MySQL, Oracle.

 

g)     Write the functions of Primary key.

Ans: The primary key uniquely identifies each record in a database table and ensures that no duplicate records exist.

 

h)    What is query? Write its type.

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.

Its types are Select Query and Action Query (Update, Delete, Append and Make Table)

 

i)      Define Form and Report.

Ans: A form is a user interface that allows users to enter and modify data in a database.

A report is a formatted output of database data, often used for printing or presenting information.

 

 

 

 

 

 

5. Write down the output of the given program. Show with dry run in table.

DECLARE FUNCTION PRE(A)

CLS

A=12345

S=PRE(A)

PRINT S

END

 

FUNCTION PRE(A)

WHILE A < >0

R = A MOD 10

S=S+R

A=A\10

WEND

PRE=S

END FUNCTION

 

Dry Run Table

A

WHILE A < >0

R = A MOD 10

S=S+R

A=A\10

PRINT S

12345

12345<>0 YES

=12345 MOD 10

=5

=0+5=5

12345\10

=1234

15

 

1234<>0 YES

1234 MOD 10

=4

=5+4=9

1234\10

=123

 

 

123<>0 YES

123 MOD 10

=3

=9+3=12

123\10=12

 

 

12<>0 YES

12 MOD 10

=2

12+2=14

12\10=1

 

 

1<>0 YES

1 MOD 10=1

14+1=15

1\10=0

 

 

0<>0 NO

LOOP EXITS

 

 

 

 

 

 

 

 

 

 

The output of the program is :

15

 

6. Re-write the given program after correcting the bugs:

REM to create sequential data file "record.dat" to delete some records.

CLS

OPEN "record.dat" FOR INPUT AS  #I

OPEN "new.dat" FOR OUTPUT AS #1

WHILE NOT EOF(#1)

INPUT #1 N$, A$, PH

PRINT N$, A$, PH

INPUT "Do you want to delete this record?(y/n)"; an$

IF LCASE(ans$) < > "y" then

WRITE #2, N$, A$, PH

ENDIF

WEND

CLOSE #1, #2

DEL "record.dat"

NAME "new.dat" AS "record.dat"

END

Debugged Program

REM to create sequential data file "record.dat" to delete some records.

CLS

OPEN "record.dat" FOR INPUT AS #1

OPEN "new.dat" FOR OUTPUT AS #2

WHILE NOT EOF(1)

INPUT #1, N$, A$, PH

PRINT N$, A$, PH

INPUT "Do you want to delete this record?(y/n)"; an$

IF LCASE$(an$) < > "y" THEN

WRITE #2, N$, A$, PH

END IF

WEND

CLOSE #1, #2

KILL "record.dat"

NAME "new.dat" AS "record.dat"

END

 

7. Study the following program and answer the given

 

DECLARE SUB TEN (A$)

B$=SCIENCE"

CALL TEN(B$)

END

 

SUB TEN(C$)

L=LEN(C$)

FOR I=1 TO 4

D$=MID$(C$,I,L)

PRINT TAB(I); D$

L=L-2

NEXT I

END SUB

 

Questions:

 

a. How many parameters are used in the above program?

Ans: - One parameter is used in the above program

 

b. List the different library functions used in the above program.

Ans: MID$( ), LEN ( ) , TAB ( ) are library functions used in the above program.

 

8. Convert/calculate as per the instruction: [4×1-41

 

a. (11011)2 into Decimal number

Ans:

(11011)₂

=(1 × 2⁴) + (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰)

=(1 × 16) + (1 × 8) + (0 × 4) + (1 × 2) + (1 × 1)

=16+8+0+2+1

= (27)₁₀

(11011)₂ = (27)₁₀

b (2AF)16 into Octal number

Ans:

Convert each hex digit to 4 binary digits and then convert each 3 binary digits to octal digits (see conversion tables below):

2AF

Converting Hexadecimal to Binary

2 = 0010

A = 1010

F = 1111

= 10 1010 1111

Now, Converting Binary to Octal

1 = 1

010 = 2

101 = 5

111 = 7

= 1257

(2AF)16 =(1257)8

 

c. 1100x100-101

 

 

 

 

 

1

1

0

0

 

 

 

 

 

x

1

0

0

 

 

 

 

 

0

0

0

0

 

 

 

 

0

0

0

0

x

 

 

 

1

1

0

0

x

x

 

 

 

1

1

0

0

0

0

 

 

 

 

 

 

1

0

1

 

 

 

1

0

1

0

1

1

 

1100x100-101 = 101011

 

d. 10001 / 110

110)

1

0

0

0

1

(10

 

-

1

1

0

 

 

 

0

0

1

0

1

 

 

 

 

 

-

0

 

 

 

 

1

0

1

 

 

Q=10

R=101

 

9. a. Write a program in Qbasic that ask the radius of a hemisphere and calculate its volume and total surface area. Create a user-defined function First(r) to calculate volume and sub-procedure Second(r) to calculate total surface area of a hemisphere. [Hints: TSA=3pr2, V=2/3pr3)

 

DECLARE FUNCTION First(r)

DECLARE SUB Second(r)

CLS

INPUT "Enter the radius of the hemisphere: ", r

PRINT "Volume of hemisphere: "; First(r)

CALL Second(r)

END

 

FUNCTION First(r)

First = (2 / 3) * 3.1416 * r ^ 3

END FUNCTION

 

SUB Second(r)

TSA = 3 * 3.1416 * r ^ 2

PRINT "Total Surface Area: "; TSA

END SUB

 

b. A sequential data file called "list.dat" has stored data under the field heading items name quantity and rate. Write a program to update all the records by increasing the rate by 10%.

OPEN "list.dat" FOR INPUT AS #1

OPEN "temp.dat" FOR OUTPUT AS #2

WHILE NOT EOF(1)

INPUT #1, item$, quantity, rate

rate = rate + 10/100 * rate

WRITE #2, item$, quantity, rate

WEND

CLOSE #1, #2

KILL "list.dat"

NAME "temp.dat" AS "list.dat"

END

 

10. Write a program in C language to enter a number and find out whether it is positive or negative

 

#include <stdio.h>

int main()

{

    int num;

    printf("Enter a number: ");

    scanf("%d", &num);

    if (num > 0)

        printf("The number is positive.\n");

    else if (num < 0)

        printf("The number is negative.\n");

    else

        printf("The number is zero.\n");

    return 0;

}

Write a C program to display the sum of first 10 natural number.

#include <stdio.h>

int main()

{

    int sum = 0;

    for (int i = 1; i <= 10; i++) {

        sum += i;

    }

    printf("The sum of the first 10 natural numbers is: %d\n", sum);

    return 0;

}

 

Copyright © 2024 Deepak Shrestha [2081 B.S.]

1 comment: