Wednesday, May 22, 2024

SEE QBASIC MODULAR PROGRAMMING 2081

  SEE QBASIC MODULAR PROGRAMMING 2081




1.      Write a program in QBASIC that asks any two numbers and calculate

 its sum and difference. Create a user defined function to calculate sum and sub-program to calculate difference.

2.      Write a program in QBASIC that asks any three numbers and calculate its product and average. Create a user defined function to calculate product and sub-program to calculate average.

3.      Write a program in QBASIC to find out sum of three numbers using SUB procedure and average of three numbers using FUNCTION procedure.

4.      Write a program in QBASIC that asks two numbers to find sum of squares of two numbers using SUB....END SUB program and average of two numbers using FUNCTION...END FUNCTION.

5.      Write a program in QBASIC that asks any number and display its square and square root. Create a user defined function to display square root and sub-program to display square of a number.

6.      Write a program in QBASIC that asks any number and display its cube and cube root. Create a user defined function to display cube and sub-program to display cube root of a number.

7.      Write a program in QBASIC that asks length, breadth and height of room and calculate its area and volume. Create a User Defined Function to calculate Area and Sub Program to calculate the Volume. [Hint: Area LxB and Volume = LxBxH] [SEE 2080]

8.      Write a program in QBASIC that asks radius of a circle to calculate its area and circumference. Create a user defined function to calculate area and sub program to calculate circumference. [Hint A= pr2, C= 2pr] [SEE 2079] [SEE 2078 GP-A]

9.        Write a program in QBASIC that ask the radius of circle. Write a program to calculate the area and circumference of a circle. Create a user defined function first (r) to calculate area and sub procedure second (r) to calculate circumference of a circle

10.    Write a program in QBASIC that asks length, breadth of a room and calculate its area and perimeter. Create a user defined function to calculate area and sub program to calculate perimeter. [Hint: [Area=LxB], [p=2(L+B]] [SEE 2078] [SEE 2079 GP]

11.    Write a program in QBASIC that will asks the user to input length, breadth and height of a room then use SUB procedure calculate its volume and FUNCTION procedure to calculate its area of four walls. [Hint: Area=2H(L+B), Volume=[L*B*H] [SEE 2078 GP-B]

12.    Write a program in QBasic that ask the radius and height of a cylinder and calculate the volume and curve surface area. Create a user-defined function to calculate volume and sub-procedure to calculate curve surface area of a cylinder. [Hints: V=πr2 h, CSA=2πrh] [KP 2079 B]

13.    Write a QBASIC program that asks length, breadth, height and calculate Volume of Cuboid and Total Surface Area. Create a USER DEFINED FINCTION to calculate Volume of Cuboid and SUB-PROGRAM to calculate Total Suface of Area. [Hint: V=LxBxH, TSA=2(LB+LH+BH) [S2079]

14.    Write a program to find area of four walls using FUNCTION... END perimeter of rectangle using SUB...END SUB. [Hint: A=2H(L+B), P=2(L+B) [NP 2079]

15.    Write a program in QBasic that ask the radius and height of a cylinder and calculate the volume and total surface area. Create a user-defined function to calculate total surface area and sub-procedure to calculate volume of a cylinder. [Hints: V=πr2 h, CSA=2πr(r+h)]

16.    Write a program in QBASIC that asks radius of a circle and calculate its Total Surface Area and Volume of sphere. Create a user - defined function to calculate volume of sphere and sub procedure to calculate Total Surface Area. [TSA=4pr2, Volume= ]

17.    Write a program in QBASIC that asks length, breadth and height and calculate its Total Surface Area and Curved Surface Area of cuboid. Create a user - defined function to calculate Total Surface Area of Cuboid and sub procedure to calculate Curved Surface Area of Cuboid. [CSA=2h(l+b), TSA=2(lb+bh+hl) ]

18.    Write a program in QBASIC that asks length of a room and calculate its area and perimeter. Create a user defined function to calculate area and sub program to calculate perimeter.[Hint: [Area=L^2], [p=4*L]

19.    Write a program in QBASIC that allows user to enter radius of a circle. Create a user defined function to find the area of circle and sub procedure to find volume of a cylinder. Hint: [A= pr2        v= pr2h]

20.    Write a program in Q-BASIC that asks first term, common Difference and No. of terms of an arithmetic series and calculate its general term and sum. Create a Function procedure to calculate general term and sub procedure to calculate sum.    [Hint:- tn = a+(n-1)xd and Sn = n/2 [2a+(n-1)xd]

21.    Write a program in QBASIC that asks principal, time and rate of interest and calculate simple interest and amount. Create a user- defined function to calculate simple interest and sub-program to calculate amount. Hint: [SI=P*T*R/1001, (A=P+SI)

22.    Write a q basic program asks length, breath and height of a room and calculates its volume and perimeter. Create FUNCTION...........END FUNCTION to find the volume and SUB END SUB to calculate perimeter.

23.    Write a program in QBASIC to  calculate circumference of a circle using sub and volume of a cylinder using function procedure.. [Hint V= pr2h, C=2pr]

24.    Write a program in QBASIC that asks radius of a circle and calculate its curved surface area and volume of hemisphere. Create a user - defined function to calculate volume of hemisphere and sub procedure to calculate curved surface area. [Hint: V=(2/3) 𝜋r3  , CSA= 2𝜋r2

25.    Write a program in QBASIC that asks radius of a circle and calculate its total surface area and volume of hemisphere. Create a user - defined function to calculate volume of hemisphere and sub procedure to calculate total surface area. [Hint: V=(2/3) 𝜋r3  , TSA= 3𝜋r2

26.    Write a program in QBASIC to define a function procedure to display the cube root of an integer supplied by the user. Use sub procedure module to calculate and print the difference between cube root and square root the same integer.

27.    WAP to calculate area of rectangle using SUB...END SUB and arca of circle using FUNCTION...END Function.

28.    Write a program using FUNCTION .... END FUNCTION to find the area of a tringle. [Hint: Area = 1/2 (bxh)]

29.    Using FUNCTION……END FUNCTION, write a program to calculate distance travelled by a body. (Hint: s=ut+ (1/2) at2)

30.    Write a program using Function…..End Function to get temperature in Celsius from the user and then print the temperature in Fahrenheit.(hint: F=9C/5+32)                                                                       

 

Thursday, April 4, 2024

SOLVED SEE COMPUTER SCIENCE 2080

 

SEE 2080 (2024)

RE-3031

Group 'A'

Answer the following questions in one sentence:

 

What is unguided media?

Unguided communication is a communication channel in which data and information transferred between two devices without using wire or cable.

 

What is the business done through the mobile?

M-Commerce

 

Which data type is used to store date of birth in MS-Access?

Date/Time

 

Write any two elements of database.

Field and Record

 

What is modular programming?

Modular programming is a technique used to divide our program into many small logical, manageable and functional modules or blocks

 

Write any two features of C- language.

C is a Structured Programming Language. which break down a program in several small modules and makes the programmer easier to manage and debug the code.

C combines elements of a high level language with some features of assembler which helps to manipulates memory address.

 

Write appropriate technical term for the following:

 

A secret group of characters used to protect computer system from unauthorized users. Password

An artificial environment created by a computer system that appears real. Virtual reality

 

Write the full form of the following

(i) URL – Uniform Resource Locator

ii) STP – Shielded Twisted Pair Cable

 

Answer the following questions:

 

Define network topology. Sketch a drawing of star topology.

Network topology is the inter-connected pattern of network components.

 

 

 

Write any four commandments of computer ethics.

·         Do not use a computer to publish fake information.

·         Do not search the file or record of other people.

·       Do not destroy or delete the records of other people.

·      Do not use a computer to steal someone's privacy.

 

What are the computer security threats? Mention any two measures to protect from security threats.

Computer security threat is a risk which can potentially harm computer systems and organization.

Any two measures to protect from security threats are:

  Firewalls

  Cryptography

 

What is E-commerce? List any two E-commerce companies in Nepal.

E-Commerce refers to electronic transactions such as buying, selling and exchanging of goods, services and information over computer communication network such as the Internet.

Any two E-commerce companies in Nepal are sastodeal and  daraz

 

Define Artificial Intelligence with examples.

AI is an emerging branch in computer science, which interprets the means and method of making computers think like human beings.

Examples are self driving cars and speech recognition (like Siri, Microsoft Cortana,

 

List any four features of MS-Access.

a)      It provides the flexible ways to add, edit, delete and display the related data.

b)      Queries help to view, change and analyse the data indifferent ways.

c)      Forms are used for viewing and editing the information.

d)     Reports are used for summarizing and printing the data.

 

What is Primary Key? Give any two benefits of it.

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.

It sets the relationship between tables.

It reduces and controls duplication of record in a table

 

Give the differences between the Select Query and Action Query.

 

Select Query

Action Query

Select query is simply used to select and display the relevant data from the database.

An action query is a query that makes changes to or removes many records in just one operation.

It does not make change to database.

It makes change to database.

A query does not save data; rather, it displays information from tables.

Action query allows to preview the query results before performing it, which is a nice feature.

A select query is a database item that presents information in Datasheet view.

Multiple records can be added, updated, or deleted simultaneously using action queries.

 

Identify a record and field from the following table structure:

Symbol No.

Name

Marks

00100202S

Aarambha Shrestha

91

00100203T

Suhisha Rayamajhi

99

 

Record =

00100202S

Aarambha Shrestha

91

00100203T

Suhisha Rayamajhi

99

 

Field = Symbol No. , Name and Marks

 

Write down the output of the given program and show them in dry run table:

DECLARE FUNCTION SQN (N)

CLS

S=0

FOR L=1 TO 3

READ NUM

S=S+SQN (NUM)

NEXT L

PRINT "Sum of square"; S

DATA 1, 4, 5

END

FUNCTION SQN (N)

SQN = N^2

END FUNCTION

 

S

L=1 TO 3

Read Num

S=S+SQN(NUM)

SQN=N^2

 

 

 

0

1 TO 3 yes

1

0+1=1

1^2=1

 

 

 

 

2 TO 3 yes

4

1+16=17

4^2=16

 

 

 

 

3 TO 3 yes

5

17+25=42

5^2=25

 

 

 

 

4 TO 3 No

Loop Exits

 

 

 

 

 

 

 

The output of the program is :

 

Sum of square 42

 

Re-Write the given program after correcting the bugs:

DECLARE SUB Square (A)

REM to print square of a input number

CLS

GET "Enter a number"; N

Square (N)

 END

SUB Square (A)

Sq = A^ 4

Display "Square of a number is "; Sq

 End Sub

 

Debugged Program

DECLARE SUB Square (A)

REM to print square of a input number

CLS

INPUT "Enter a number"; N

CALL Square (N)

 END

SUB Square (A)

Sq = A^ 2

PRINT  "Square of a number is "; Sq

 End Sub

 

Study the following program and answer the given questions:

DECLARE FUNCTION Count (W$)

INPUT "Enter a word"; R$

C = Count (R$)

PRINT C

END

FUNCTION Count (W$)

FOR L = 1 TO LEN (W$)

Ch$MID$ (W$, L, 1)

 IF UCASES (Ch$) = "K" THEN

N=N+1

END IF

NEXT L

 Count = N

END FUNCTION

 

List any two library functions used in the above program.

UCASE$( ) and MID$( )

 

Write the use of variable 'C' in line 3 [i.e. C = Count (R$)] given in the above program.

The use of variable ‘C’ in  line 3 [i.e. C = Count (R$)] given in the above program is to store the value returned by the function count( ).

 

(Group 'C'

(Convert/Calculate as per the instruction):

 

1) i) (ABC)16(?)8

 

Convert each hex digit to 4 binary digits (see conversion table below):

ABC

= A B C

= 1010 1011 1100

= 101010111100

Convert every 3 binary digits (from bit0) to octal digit (see conversion table below):

101010111100

= 101 010 111 100

= 5 2 7 4

= 5274

 

(ABC)16 =  (5274)8

 

 

ii) (435)10(?)2

 

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

Division
by 2

Quotient

Remainder

(Digit)

Bit #

(435)/2

217

1

0

(217)/2

108

1

1

(108)/2

54

0

2

(54)/2

27

0

3

(27)/2

13

1

4

(13)/2

6

1

5

(6)/2

3

0

6

(3)/2

1

1

7

(1)/2

0

1

8

= (110110011)2

 

435)10 = (110110011)2

 

iii) (101)2x (101)2=(?)2

 

 

 

 

1

0

1

 

 

 

X

1

0

1

 

 

 

 

1

0

1

 

 

 

0

0

0

X

 

+

1

0

1

X

X

 

 

1

1

0

0

1

 

(101)2x (101)2=(11001)2

 

 

iv) (101101)¸(101)

 

 

101)

1

0

1

1

0

1

(1001

 

-

1

0

1

 

 

 

 

 

 

0

0

0

1

0

1

 

 

 

 

 

-

1

0

1

 

 

 

 

 

 

0

0

0

 

 

 

 

 

 

 

 

 

 

Quotient = 1001

Remainder = 0

 

 

Write a program in QBASIC that asks length, breadth and height of room and calculate its area and volume. Create a User Defined Function to calculate Area and Sub Program to calculate the Volume.

[Hint: Area LxB and Volume = LxBxH]

 

DECLARE FUNCTION AREA(L,B)

DECLARE SUB VOL(L,B,H)

CLS
INPUT “Enter Length”; L

INPUT “Enter Breadth”; B

INPUT “Enter Height”; H

PRINT “Area of room=”; AREA(L,B)

CALL VOL(L,B,H)

END

 

FUNCTION AREA(L,B)

AREA = L * B

END FUNCTION

 

SUB VOL(L,B,H)

V=L*B*H

PRINT “Volume of Room=”; V

END SUB

 

Employee's name, address, gender and salary are stored in the "EMP.DAT" sequential data file. Write a QBASIC program that displays all information about personnel whose salaries exceed 60000.

 

OPEN "EMP.DAT" FOR INPUT AS #1

CLS

WHILE NOT EOF (1)

    INPUT #1, N$, A$, G$, S

    IF S > 60000 THEN PRINT N$, A$, G$, S

WEND

CLOSE #1

END

 

 

Write a program in 'C' language to find simple interest where user need to input Principle, Rate and Time.

 

#include<stdio.h>

#include<conio.h>

int main()

{

float p, t, r, i;

printf("Enter principal: ");

scanf("%f", &p);

printf("Enter time: ");

scanf("%f", &t);

printf("Enter rate: ");

scanf("%f", &r);

i = (p*t*r)/100;

printf("Simple Interest = %.2f", i);

return 0;

}

 

अथवा (Or)

Write a program in 'C' language to display the series with their sum. 1,2,3,4, up to 10th term.

 

#include <stdio.h>

 

int main() {

   int i,s=0;

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

{

    printf("%d ",i);

    s=s+i;

}

printf("\n Sum =%d",s);

    return 0;

}