Saturday, April 9, 2022

Modular Programming Question Collection Qbasic 2078

 PROGRAMMING QUESTION

[9 Marks]

 

Group A

1.      Write a program to calculate the volume of a cylinder using FUNCTION….END FUNCTION.[ MODEL 2065], [ 2071 S]

2.      Using FUNCTION….END FUNCTION, Write a program to calculate distance travelled by a body. [ 2065R]

3.      Write a program using SUB…END SUB to get radius of circle and then print its area./FUNCTION [ 2065 S], [ 2071 R] [2074U][2074]

4.      Write a program using FUNCTION module to calculate and print the volume of a box. [ 2066 R]

5.      Write a program using FUNCTION…END FUNCTION to find the average of any two numbers given by the user. [ 2066 S]

6.      Using FUNCTION…END FUNCTION Write a program to calculate the average of three numbers. [ 2067 R], [ 2070 S][2075]

7.      Write a program using SUB…END SUB to get radius of a circle and then print its circumference. [ 2067 S]

8.      Write a program to calculate the area of four walls using SUB…END SUB / FUNCTION. [ 2068 R], [ 2073][2075U]

9.      Write a program in QBASIC to find the total surface area of a box using FUNCTION…END FUNCTION. [ 2068 S]

10.   Write a program to calculate and print the simple interest using FUNCTION…END FUNCTION. [ 2069 S]

11.   Write a program using FUNCTION…END FUNCTION to get temperature in celsius from the user and then print the temperature in fahrenheit. [ 2070 R]

12.   Write a program using FUNCTION…END FUNCTION, to find the area of triangle. [ 2072]

 

 

Group B

1.      Write a program using FUNCTION…END FUNCTION, to get a word from the user and the print the word in reverse order. [ 2065 S], [ 2067 S], [ 2068 R][2074U]

2.      Write a program to declare SUB procedure to print only the vowels from a given word. [ 2066 R]

3.      Write a program using SUB…END SUB to get a word from the user and then print it in reversed order. [ 2070 R], [ 2072]

4.      Write a program using FUNCTION…END FUNCTION to input a string and count the total number of consonants. [ 2071 R]

5.      Write a program to count the total number of vowels using FUNCTION…END FUNCTION. [2073][2075]

6.      Write a program using FUNCTION... END FUNCTION to count the number of words in a sentence.[2074]

 

 

Group C

1.      Write a program to test whether the given number is positive or negative using SUB…..END SUB. [ MODEL 2065 ], [ 2066 S]

2.      Using SUB…END SUB Write a program to test whether the given number is completely divisible by 13 or not. [ 2067 R]

3.      Write a program to input three different numbers in the main module and then find the greatest number using SUB…END SUB. [ 2068 S]

4.      Using Functions ........ End Functions write a program to find odd or even. [20475U]

 

Group D

1.      Using SUB…END SUB Write a program to print the following series 9,7,5,…1. [ 2065 R]

2.      Write a program using SUB…END SUB to print the series 1,1,2,3,5,8… upto ten terms. [ 2069 R]

3.      Write a program to print natural numbers from 1 to 5 using SUB…END SUB. [ 2069 S]

4.      Write a program using SUB…END SUB to print the first ten odd numbers. [ 2071 S]

5.      Write a program to print the sum of digits of a given number using SUB procedure. [ 2070 S]

 

 

Tuesday, April 5, 2022

QBASIC FILE HANDLING PROGRAMMING QUESTIONS[ SEE COLLECTION] [4 Marks]

 QBASIC FILE HANDLING PROGRAMMING QUESTIONS[ SEE COLLECTION]


1.      Create a sequential data file “std.dat” to store name and marks obtained in English, Math and Science subjects for a few students. [ MODEL 2065]

2.      Write a program to store records regarding the information of Book Number, Book’s name and Writer’s name in a sequential data file called “Library.dat”. [ 2065 R]

3.      A sequential data file called “MARKS.DAT” contains roll no., name, English, nepali and maths fields. Write a program to display all the contents of data file. [ 2065 S], [ 2067 S]

4.      Write a program to create a sequential  data file “Employee.dat” to store employees’ name, address, age and gender. [ 2066 R]

5.      A data file “LIB.TXT” consists of Book’s name, Author’s name and price of books. Write a program to count and display the total number of records present in the file. [ 2066 S]

6.      A sequential data file “EMP.DAT” contains name, post and salary fields of information about employees. Write a program to display all information of employees along with tax amount also.(Tax is 15% of salary) [ 2067 R]

7.      Write a program to create a data file 'emp.dat' to store employees name, post, address and salary according to the need of the user. [2075U]

8.      Write a program to store Roll no., Name, Class and Address of any five students. [2074]

9.      A sequential data file called “student.dat” contains some records under the fields Name, English, Nepali and computer. Write a program to add some more records in the same sequential data file. [ 2068 R]

10.   Write a program to view those records from “Employee.dat” sequential data file having employee’s name, department, appointment data and salary whose salary is more than Rs 5000. [ 2068 S]

11.   Write a program to create a data file “teldir.dat” to store name, address and telephone number of employees according to the need of the user. [ 2069 R]

12.   A sequential data file “Staff.dat” contains the name, address, post and salary of the employees. Write a program to read and display all the records stored in the above file. [ 2069 S]

13.   A sequential data file called “Marks.dat” contains name, english, nepali, maths and science fields. Write a program to display all the contents of that data file. [ 2070 R]

14.   A sequential data file “Record.dat” has records with field name, addres, age and salary. Write a program to display only those records whose age is greater than 26. [ 2070 S]

15.   A data file “Salary.dat” contains the information of employee regarding their name, post and salary/ Write a program to display all the information of employee whose salary is greater than 15000 and less than 40000. [ 2071 R]

16.   A data file “STAFF.DAT” has stored records of few employees with emp id, first name, last name, post and salary. Write a program to display all the records of the employees whose salary is more than 40,000.[2075]

17.   A sequential data file called “Marks.dat” has stored data under the field heading Roll No, Name, English, Nepali and maths. Write a program to display all the information of those students whose marks in Nepali is more than 50. [ 2071 S]

18.   A Sequential data file called ".DAT" has stored data under the field heading Symbol No., Name, English, Nepali, Maths and Computer. Write a program to display all the information of those students whose marks in Computer is more than 80. [2074U]

19.   A sequential data file called “Marks.dat” contains NAME, AGE, CITY AND TELEPHONE fields. Write a program to display all the contents of the data file. [ 2072]

20.   Create a data file to store the records of few employees having Name, Address, Post, Gender and Salary fields. [ 2073]

 

Thursday, March 31, 2022

SOLVED NPABSON SEE PRE BOARD EXAM - 2078

 SOLVED NPABSON SEE PRE BOARD EXAM - 2078

Subject: Computer                                        F.M. : 50

1. Answer the following questions in very short: 1×10=10

 

i. What is computer network?

A computer network means two or more computers connected with each other to share data, hardware, software and other resources

 

ii. What is e-mail?

E-mail (Electronic mail) is one of the most popular services provided by the internet which exchanges messages between the computers through a network.

 

iii. What is full form of ISDN?

The full form of ISDN is Integrated Services Digital Network

 

iv. What is the full form of WAN?

The full form of WAN is Wide Area Network

 

v. Write the technical term: The arrangement of connection patterns of computers or nodes and others resources. Network Topology

 

vi. Write the technical term: Commerce done by mobile. M-Commerce

 

vii. What is primary key?

A key that uniquely identifies each record in a database is primary key.

 

viii. What is DBMS?

Database management system (DBMS) is a computerized system that stores data process them and provide information in an organized form.

 

ix. What is modular programming?

Modular programming is a technique which divides a program into many small, manageable, logical and functional modules or blocks.

 

x. Write down two data type of C language.

The two data types used in C language are  char and  int

 

 

3. Answer the following questions in short: 2×9=18

 

i. What is transmission medium? Write down with examples.

Transmission medium is a pathway that can transmit information from a sender to a receiver through wired or wireless medium on a network. Examples are: twisted pair cable, co-axial cable, radio wave, microwave etc

 

ii. What is Internet? Write down its services.

Internet is an interconnection of several thousands of computers of different types belonging to the various networks all over the world in order to share data and information. The services of internet are: WWW (World Wide Web), E-mail (Electronic mail), FTP (File Transfer Protocol), IRC (internet Relay Chat) etc.

 

 iii. What is computer security? Give some examples.

The protection of computer systems and information from harm, theft, and unauthorized use is called computer security. Examples are: Password, Biometric, Firewall, Cryptography etc.

 

 iv. What is cyber law? Give some examples.

Cyber law refers to the laws regarding the internet and cyberspace which includes a wide variety of legal issues related to the use of communication technology. Examples of cyber law are Electronic and Digital Signature Law, Cyber Crime Law, Intellectual property Law, Data Protection and Privacy Law etc.

 

v. What is computer virus? Give some examples.

Computer virus is a type of computer program which is written by the programmer with the intent of destroying or damaging the data and programs residing in the computer system. E.g. C-Brain, Frodo, Disk Killer, I Love You etc

 

vi. What is data type? What happens while we enter text in number data type?

Data type is an attribute for a field that determines what type of data it can contain. If we enter text in a numeric field then it displays the errors.

 

vii. What is sort?

Sorting is the process of arranging the record in ascending or descending order according to a given field or fields.

 

viii. What is table? Is table a database?

Table is an object of Ms-Access that stores large volume of data in the form of rows and columns. No, Table is not a database. A table is an object inside a database

 ix. What is report?

Report is an object of Ms-Access which displays the output in an effective way to present the data in a printed format.

 

x. Debug the following program.

DECLARE FUNCTION PAL$ (W$)

CLS

INPUT "Enter a word"; W$

SHOW PAL$ (W$)

END

FUNCTION PAL$ (W$)

FOR I= LEN (W$) TO 1 STEP1

 R$=R$+MID$ (W$, I, 1)

NECT I

IF R$-W$ THEM

P$="Palindrome"

ELSE

P$="Not palindrome"

ENDIF

P$=PAL$

 END FUNCTION

 

Debugged Program

DECLARE FUNCTION PAL$ (W$)

CLS

INPUT "Enter a word"; W$

PRINT PAL$ (W$)

END

 

FUNCTION PAL$ (W$)

FOR I= LEN (W$) TO 1 STEP-1

 R$=R$+MID$ (W$, I, 1)

NEXT I

IF R$=W$ THEM

P$="Palindrome"

ELSE

P$="Not palindrome"

ENDIF

PAL$ =P$

 END FUNCTION

 

xi. What will be output?

DECLARE FUNCTION FACT (N)

CLS

N=5

PRINT FACT (N)

END

FUNCTION FACT (N)

 F=1

FOR I=1 TO N

F=F*I

NEXT I

FACT=F

END FUNCTION

Dry Run

 

Var.

Var.

Var.

 

Output

N

F

I

FOR I=1 to 5Yes

 

5

1

1

 

 

 

1

2

2 to 5 Yes

 

 

2

3

3 to 5 Yes

 

 

6

4

4 to 5 Yes

 

 

24

5

5 to 5 Yes

 

 

120

6

6 to 5 No

LoopExits

120

 

            Output

            120

 

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

DECLARE SUB PC$ (N)

CLS

 INPUT "Enter a number"; N

CALL PC$ (N)

END

SUB PC$ (N)

 FOR I=2 TO N-1

 R=N MOD I

 IF C=0 THEN

PRINT "Prime number"

 ELSE

PRINT "Composite number"

 ENDIF

END SUB

 

a.     What is the name of sub procedure?

The name of the sub procedure is PC$( )

 

b.     List the local variable.

The local variable are N, I, R, C

 

 

 

 

1. Write a program in QBASIC to ask a number and display sum of digits by using FUNCTION..END FUNCTION. [4]

DECLARE FUNCTION SUM (N)

CLS

INPUT "ENTER ANY NUMBER"; N

PRINT "SUM OF DIGITS="; SUM(N)

END

 

FUNCTION SUM (N)

S = 0

WHILE N < > 0

R = N MOD 10

S = S + R

N = N \ 10

WEND

SUM = S

END FUNCTION

 

2. Write a program in QBASIC to create a file "EMP.DAT" and store employees Name, Address, Salary and Telephone number on the basis of user choice. [4]

OPEN “EMP.DAT” FOR OUPUT AS #1

DO

CLS

INPUT “ENTER NAME”; N$

INPUT “ENTER ADDRESS”; A$

INPUT “ENTER SALARY”; S

INPUT “ENTER TELEPHONE NUMBER”; T

WRITE #1, N$, A$, S, T

INPUT “DO YOU WANT TO CONTINUE”; CH$

LOOP WHILE UCASE$(CH$) = “Y”

CLOSE #1

END

 

3. Write a program in C language to ask length, breadth and height and display volume of box. [4]

#include<stdio.h>

#include<conio.h>

int main()

{

int l,b,h,v;

printf("Enter length: ");

scanf("%d", &l);

printf("Enter breadth: ");

scanf("%d", &b);

printf("Enter height: ");

scanf("%d", &h);

v=l*b*h;

printf("Volume of box= %d", v);

return 0;

}

 

 

 

2. Solve the problem as indicated: 1×4=4

i. (209)10 into Octal number         

ii. (A0F)16 into Binary number.

 

i. (1011011)2 × (110)2                   

ii. (1110001)2 ÷ (101)2