46 Solved Computer Science 2081
46 Solved Computer Science 2081
2. Write the appropriate technical term for the following statements: [2×1-2]
a Network connecting device that boosts the data signals. Repeater
b. The use of computer technology to create a simulated environment. Virtual Reality (VR)
5. Write down the output of the given program (Show with a dry run at a table).
DECLARE SUB SHOW(A)
CLS
N-87
CALL SHOW(N)
END
Debugged Program
REM To add more data in a sequential file
OPEN "EMP.DAT" FOR APPEND AS #1
DO
INPUT "ENTER NAME"; N$
INPUT "ENTER ADDRESS"; A$
INPUT "ENTER SALARY"; S$
WRITE #1, N$, A$, S$
INPUT "Do you want to add more records"; M$
LOOP WHILE UCASE$(M$) = "Y"
CLOSE #1
END
(912)10 = (?)8
(912)10 = (1620)8
1 0 0 1 0
1 1 1 0
0 0 0 0 0
1 0 0 1 0 x
1 0 0 1 0 x x
1 0 0 1 0 x x x
1 1 1 1 1 1 0 0
- 1 0 1 0 1
1 1 1 0 0 1 1 1
(1011101)2 / (111)2
111) 1 0 1 1 1 0 1 (1101
1 1 1
1 0 0 1
1 1 1
0 0 1 0 0 1
- 1 1 1
0 0 1 0
Q=1101
R=10
Wise a program in QBASIC that asks any number and display its square and square root: Create a user-
defined function to calculate square root and a sub program to display the square of a number.
FUNCTION SQRT(X)
SQRT = SQR(X)
END FUNCTION
SUB SQUARE(X)
PRINT "Square: "; X * X
END SUB
A data file "Staff.dat” has stored records of few employers with EmpID, name, address post and salary.
Write a program is display all the records of the employees whose address is "Nepal" and salary is than
40.000 (4)
10. Write a program in C language that asks any integer value and checks whether it is odd or even
#include <stdio.h>
int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);
if(num % 2 == 0) {
printf("%d is even.\n", num);
} else {
printf("%d is odd.\n", num);
}
return 0;
}
OR
#include <stdio.h>
int main() {
5|P a g e CS SEE PABSON SOS 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
int i, count = 0;
for(i = 1; count < 10; i += 2) {
printf("%d\n", i);
count++;
}
return 0;
}
d) What is a RDBMS?
RDBMS is a type of DBMS that uses a relational model to organize and manage data, allowing users to
easily retrieve and manipulate it.
f) Which mode is used to add data items into the already existed data file in QBASIC?
APPEND mode is used to add data items into the already existed data file in QBASIC
a) The amount of data transmitted per second through the communication channel. Bandwidth
b) The process of making copies of data or data files to use in the event the original data or data files are lost
or destroyed. Backup
g) Write any two differences between data sorting and data filtering.
Sorting Filtering
The process of arranging all the records in a table Filtering is the process of viewing required record
either ascending or descending order based on field of a table that matches the specifies criteria.
or fields is known as sorting.
Sorting affects the entire dataset. Filtering only affects the data that is displayed.
Sorting is often used to make data easier to read. Filtering is used to find specific information.
Sorting can be done in ascending or descending Filtering has various criteria that can be applied.
order.
h) Write a difference between database and DBMS. Give one example of manual database.
2|P a g e CS SEE NPABSON 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Database DBMS
A collection of systematically organized inter- Database management system (DBMS) is a
related data is called a database. computerized system that stores data, processes
them and provides information in an organized
form
Besides computers, databases can even be In a database management system (DBMS), all the
maintained in physical ledgers, books, or papers. records are maintained only on a computer.
In the case of the databases, very less information In the database management system (DBMS), a lot
can be modified at a time. of information can be changed at one time (as it can
have many users using it at the same time).
Eg. Dictionary, Marks Ledger, Telephone E.g. MS-Access, Oracle, MS-SQL Server, MySQL,
Directory, Attendance Register etc. PostgreSQL etc
Telephone Directory is an example of manual database.
5. Write down the output of the given programs. Show with dry run in a table.
DECLARE SUB Display(S$)
CLS
S$=”TOEPOHSDRA"
CALL Display (S$)
END
SUB Display(S$)
LET I=48
FOR C=1 TO 4
P=I MOD 7
R$=R$+ MID$(S$, P, 1)
I=I-1
NEXT C
PRINT R$
END SUB
Dry Run
S$ I C=1 TO 4 P=I MOD 7 R$=R$+ I=I-1 PRINT R$
MID$(S$, P,
1)
TOEPOHSDRA 48 1 TO 4 yes 48 MOD 7= H 48-1=47 HOPE
6
2 TO 4 yes 47 MOD 7 = HO 47-1=45
5
3 TO 4 yes 46 MOD 7= HOP 45-1=44
4
4 TO 4 yes 45 MOD 7 = HOPE 44-1=43
3
5 TO 4 no
Loop exits
The output of a program is:
HOPE
3|P a g e CS SEE NPABSON 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Debugged Program
REM Program to add records to an existing file "Student.dat"
OPEN "Student.dat" FOR APPEND AS #1
DO
CLS
INPUT "Enter name: "; N$
INPUT "Enter Address: "; Ad$
INPUT "Enter Total Marks: "; TM
WRITE #1, N$, Ad$, TM
INPUT "Do you want to add more records? Press Y or N: "; CH$
LOOP WHILE UCASE$(CH$) = “Y”
CLOSE #1
END
GROUP C
9. (a) Write a program in QBASIC to find out sum of three numbers using SUB procedure and average of
three numbers using FUNCTION procedure.
DECLARE SUB SUM(A, B, C)
DECLARE FUNCTION AVG(A, B, C)
CLS
INPUT “Enter first number”; A
INPUT “Enter second number”; B
INPUT “Enter third number”; C
CALL SUM(A, B, C)
PRINT Average of three numbers=”; AVG(A, B, C)
END
SUB SUM(A, B, C)
S=A+B+C
PRINT “Sum of three numbers=”; S
END SUB
FUNCTION AVG(A, B, C)
AVG=(A+B+C)/3
END FUNCTION
(b) A sequential data file, "record.dat." contains several records with data items name, address, age, and
phone number. Write a program to display the records of students whose age is greater than or equal to 18.
10. Write a program in C language to input length of three rods and display whether the triangle can be
formed by those rods or not. [4]
#include <stdio.h>
int main() {
float a, b, c;
printf("Enter the length of rod for side 1: ");
scanf("%f", &a);
printf("Enter the length of rod for side 2: ");
scanf("%f", &b);
printf("Enter the length of rod for side 3: ");
scanf("%f", &c);
if (a + b > c && a + c > b && b + c > a)
{
printf("The triangle can be formed by rods.\n");
}
else
{
printf("The triangle cannot be formed by rods.\n");
}
return 0;
}
OR
Write a program in C language to declare whether the given number is 'Positive', 'Negative' or 'Zero'.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n>0)
printf("%d is positive number",n);
else if(n<0)
printf("%d is negative number",n);
else
printf("%d is zero number",n);
return 0;
}
Candidates are required to give their answers in their own words as far as practicable.
Subject: Computer Science
b) Define Cryptography.
Ans: Cryptography is the study of secure communications techniques that allow only the sender and
intended recipient of a message to view its contents
f) List any two examples of format specifier (Conversion Character) used in C Language.
Ans: Any two examples of format specifier (Conversion Character) used in C Language are %d (int) and %f
(float)
a) What is Transmission Media? Mention its types with at least any two examples of each.
Ans: A channel or path through which data and information are transmitted between connected devices in a
network environment is called communication media. Its types are :
1. Guided (Wired/bounded) communication media - Twisted pair Wire , Co-Axial Cable
2. Unguided (Wireless/unbounded) communication media - Radio Wave , Micro Wave
Ans: Virtual Reality (VR) is the use of computer technology to create a simulated environment that doesn’t
actually exist, that can give a feel of near real world with all or some of senses experiencing the virtually
simulated environment.
Its application areas are:
• Gaming- VR Gaming allows players to immerse (dip) themselves in virtual world and interact with
environment and characters
• Education - VR can help students learn by making the content more engaging and memorable.
d) What is Digital Citizenship? List any four elements (themes) of Digital Citizenship.
Ans: Digital citizenship refers to the responsible and ethical use of technology and the internet which
involves understanding, practicing, and promoting appropriate behavior when using digital tools and
resources.
The most common type of E-Commerce is Business-to-Consumer. B2C establishes the electronic
business relationships between a business organization (merchant) and final consumers. (e.g. You
buy a pair of shoes from an online retailer)
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.
g) Define Field Name. Write any two rules for creating the Field Name
Ans: A field name refers to the name given to a specific data element within a database table.
Any two rules for creating the Field Names are:
Field names should clearly describe the data they represent.
Field names should consist of alphanumeric characters and underscores (_) only.
5. Write the output of the following program showing necessary rough: (1\times2=2)
SUB SERIES
A$="NEPAL"
B=1
FOR I=LEN(A$) TO 1 STEP-2
IF B< >3 THEN
PRINT MID$(A$, B, I)
ELSE
PRINT MID$(A$, 1, I)
END IF
B=B+1
NEXT I
END SUB
NEPAL
EPA
N
END IF
WEND
CLOSE #1 #2
KILL BUSRIDER.TXT"
NAME "TEMP.TXT" AS "BUSRIDER TXT”
END
b) Do you get any problem in above program if "Kill" statement is removed? Give reason.
Ans: Yes, We get problem in above program if "Kill" statement is removed because if the kill statement is not
used then busrider.txt file won’t be deleted and NAME statement cannot rename TEMP.TXT to
BUSRIDER.TXT because file name is already exists. So, it can’t be renamed.
b) Write a QBASIC program that asks for Employee name and stores its reverse form into a
sequential data file "Reverse Txt". Make a provision so that user can input 10 records at each
program execution.
10. Write a program in C language that asks the value of 3 sides of a triangle then check whether triangle
is Equilateral, Isosceles or Scalene.
#include <stdio.h>
int main()
{ Write a program in C language to
int side1, side2, side3; display the series with their sum: 2, 8,
printf("Enter three sidesoftriangle:"); 18, 32. upto 10th term.
scanf("%d%d%d", &side1,&side2,&side3);
if(side1= =side2&&side2==side3) #include <stdio.h>
{ int main() {
printf("Equilateral triangle."); int i;
} for(i=1;i<=10;i++)
else if(side1= =side2 || side1= =side3 || side2= =side3) {
{ printf("%d ", i*i*2);
printf("Isosceles triangle.");
} }
else return 0;
{ }
printf("Scalene triangle.");
}
return 0;
}
SET 24
Subject: Opt. II Computer Science
Time: 1:30 hrs. Full Marks: 50
a) Define bandwidth.
Ans: The amount of data that can be carried from one point to another in a given time period is called
bandwidth.
b) What is cyber-crime?
Ans: Cybercrime refers to criminal activities or illegal actions that are conducted or facilitated through the
use of digital technology or the internet.
c) Define AI.
Ans: Artificial intelligence refers to the simulation of human intelligence in machines that are programmed
to think and act like humans.
b) A secret group of characters used to protect information systems from unauthorized users. Password
Group ‘B’
4. Answer the following questions: [9x2=18]
1|P a g e CS SEE NPABSON 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
a) Differentiate between client server architecture and peer to peer architecture.
Ans: The difference between client server architecture and peer to peer architecture are:
END IF
Dry Run
A$ B I=1 to B IF I MOD 2 B$=B$+MID$(A$,I,1) Y$ PRINT Y$
=1
TECHNOLOGY 10 1 to 10 1 MOD 2=1 T TCNLG TCNLG
1=1 yes
2 to 10 2 MOD 2=1
0=1 no
3 to 10 3 MOD 2=1 T+C = TC
1=1 yes
4 to 10 4 MOD 2=1
0=1 no
5 to 10 5 MOD 2=1 TC+N=TCN
1=1 yes
6 to 10 6 MOD 2=1
0=1 no
7 to 10 7 MOD 2=1 TCN+L=TCNL
1=1 yes
8 to 10 8 MOD 2=1
0=1 no
9 to 10 9 MOD 2=1 TCNL+G
1=1 yes
10 to 10 10 MOD 2=1 TCNLG
0=1 no
11 to 10
Loop
Exit
3|P a g e CS SEE NPABSON 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
The output of the program is
TCNLG
6. Rewrite the following program after correcting the bugs. [2]
DECLARE FUNCTION SUM(N)
CLS
INPUT “ENTER A NUMBER”; N
SU= SUM(N)
PRINT “SUM =”; SUM(N)
END
FUNCTION SUM(N)
WHILE N< > 0
R = R MOD 10
S= S + R
N = N \ 10
WEND
S= SUM
END SUB
Debugged Program
FUNCTION SUM(N)
WHILE N< > 0
R = N MOD 10
S= S + R
N = N \ 10
WEND
SUM=S
END FUNCTION
7. Study the following program and answer the given questions. [2]
DECLARE SUB TEST(A$)
CLS
A$= “COMPUTER”
END
a) What statement should be added in the main module to execute the program?
Ans: CALL TEST(A$) statement should be added in the main module to execute the program.
b) List out the variables used in the above program with types.
Ans: the variables used in the above program are:
A$ - String Variable
4|P a g e CS SEE NPABSON 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
L, I – Numeric Variable
Group ‘C’
8. Convert/ calculate as per the instruction. [4]
a) (670)8 = (?)10
670
= (6 × 8²) + (7 × 8¹) + (0 × 8⁰)
=6 × 64 + 7 × 8 + 0 × 1
= 440
(670)8 = (440)10
b) (FACE)16 = (?)2
Convert each hex digit to 4 binary digits (see conversion table below):
FACE
=FACE
or, F = 1111
A = 1010
C = 1100
E = 1110
= 1111101011001110
(FACE)16 = (1111101011001110)2
c) 1100 x 110
1 1 0 0
× 1 1 0
0 0 0 0
1 1 0 0 ×
1 1 0 0 × ×
10 0 1 0 0 0
1100 x 110 = 1001000
d) 111011 ÷ 100
100) 1 1 1 0 1 1 (1110
- 1 0 0
1 1 0
- 1 0 0
1 0 1
- 1 0 0
0 0 1 1
- 0 0
1 1
Q=1110
R=11
b. Write a program to open a data file “Record.dat” which contains student’s name, class and address and
print only those students’ records whose name starts from an alphabet “A”. [4]
10. Write a program in C language to enter a number and 2, 4, 6, 8, 10, 12……………10th term.
check if it is odd or even. [4]
c) What is AI?
Ans: Artificial intelligence refers to the simulation of human intelligence in machines that are programmed
to think and act like humans.
Group B
4. Answer the following questions:
a) What is communication channel? Mention its types with at least one example, each
Ans: A channel or path through which data and information are transmitted between connected devices in a
network environment are called communication channel.
Its types are:
Guided (Wired/bounded) communication media - Twisted Pair Cable, Co-Axial Cable and Fiber Optic
Cable
Unguided (Wireless/unbounded) communication media - radio wave, microwave, satellite, infrared
b) What is cyber-crime? List any two objectives of formulating cyber law in Nepal.
1|P a g e CS SEE NPABSON 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Ans: Cybercrime refers to criminal activities or illegal actions that are conducted or facilitated through the
use of digital technology or the internet.
Any two objectives of formulating cyber law in Nepal are :
- To legalize the transaction through electronic media to control various types of electronic frauds
- To punish a person who does criminal activities through electronic means especially on computers.
g) Write a similarity and a difference between Number field type and Currency filed type.
Ans: similarity and a difference between Number field type and Currency field type
Similarity:
Both store numerical values: Both field types are designed to store numerical data.
Difference:
Currency field type is specialized for handling monetary values by including specific currency
formats and precision, whereas the Number field type is more generic and can store any numerical data
without currency-specific formatting.
5. Write the output of the given program showing the dry run table. (2)
DECLARE FUNCTION PRO(N)
CLS
A=2
FOR J=1 TO 5
X= PRO(A)
PRINT X
NEXT J
END
FUNCTION PRO(N)
N=N+2
PRO=N
END FUNCTION
Dry Run
A J=1 to 5 X N N=N+2 PRINT X
2 1 to 5 YES 4 2 2+2=4 4
2 to 5 YES 6 4 4+2=6 6
3 to 5 YES 8 6 6+2=8 8
4 to 5 YES 10 8 8+2=10 10
5 to 5 YES 121 10 10+2=12 12
6 to 5 NO
loop exits
SUB AA (N$)
R=LEN(N$) \ 2
E$=RIGHT$(N$,R) + LEFT$(N$,R)
PRINT E$
END SUB
Questions:
b) (A2B)16 = (?)2
Convert each hex digit to 4 binary digits (see conversion table below):
A2B
=A 2 B
= 1010 0010 1011
= 101000101011
=(DA3)16 =(101000101011)2
c) (101) X (111)
110) 1 1 0 1 1 0 (1001
d) (110110)¸/ (110) - 1 1 0
0 0 0 1 1 0
4|P a g e C 1S S 0E E 1N P A B S O N 2 0 8 0 h t t p s : / -/ s e 1
eqb1
a s i c0o m p u t e r . b l o g s p o t . c o m /
× 1 1 1
0 0 0
1 0 1
1 0 1 ×
Q=1001
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Group C
9. a. Write a program in QBASIC to define a function procedure to display the area of sphere and sub
procedure to display the volume of sphere where user need to input radius in main module.
[Hint: Area = 4*3.14*R^2, Volume = 4/3*3.14*R^3]
SUB AREA(R)
A=4*3.14*R^2
PRINT “Area of sphere=”; A
END SUB
FUNCTION VOL(R)
VOL=4/3*3.14*R^3
END FUNCTION
b. A sequential data file 'PRODUCT.DAT contains the information regarding product Id, Product name,
Date of manufacturing and Price of some products. Write a program to display all the records deducting the
price by 20%, where price is greater than or equal to Rs.1000. [4]
10. Write a program using C language to input an integer then check whether the integer is even or
odd.
Write a program using C language to generate the first 25 even numbers between 100 and 200.
#include <stdio.h>
int main() {
int i, count = 0;
printf("\n");
return 0;
}
a) What is bandwidth?
Ans: Bandwidth is the maximum amount of data that can be transmitted over a network connection in a
given amount of time.
c) Which data type is used to store numeric characters or special symbols in Ms-Access?
Ans: The "Text" data type in MS-Access is used to store numeric characters or special symbols.
Group B
4. Answer the following questions:
b) What is computer virus? List any two preventive ways to protect computer system from computer
virus.
1|P a g e CS SEE JEC BKT 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
A computer virus is a malicious software program designed to damage or disrupt a computer system.
Two preventive ways are:
• Installing and regularly updating antivirus software.
• Avoiding the download of files or attachments from unknown or untrusted sources.
g) List any four data types of Ms-Access. Also mention its function.
Text: Stores alphanumeric characters, including text and numbers, up to 255 characters.
Number: Stores numerical data that can be used in mathematical calculations.
Date/Time: Stores dates and times in various formats.
Currency: Stores monetary values and automatically formats them with a currency symbol.
h) What is primary key? List any two advantages of it.
A primary key is a unique identifier for a record in a database table, ensuring that each record is distinct.
Two advantages are:
• It prevents duplicate records in the table.
• It helps establish relationships between tables in a database.
SUB Result
A=1
FOR I=1 TO 5
PRINT I*A
A = A + (10 ^ I)
NEXT I
END SUB
6. Re-write the given program after correcting bugs: REM to check whether the supplied no is even or
odd
Debugged Program:
SUB TEST(N)
Y=2
R = N MOD Y
IF R = 0 THEN
PRINT "EVEN"
ELSE
PRINT "ODD"
END IF
END SUB
7. Study the following program and answer the given questions: [2]
Function count(N$)
For K = 1 to LEN(N$)
X$=MID$(N$,K,1)
IF UCASES(X$) = "A" then
X=X+1
End if
Next K
Count=X
End Function
(b) Write the use of variable "C" in line 3 [i.e. C=count(R$)] given in the above program.
Ans: The variable C stores the value returned by the function count (i.e. the number of occurrences of the
letter 'A' )
Group 'C'
(a) (2090) 10 =( )2
(2090) 10 =(100000101010 )2
1 0 0 1
+ 1 1 0
1 1 1 1
- 1 0 0 0
0 1 1 1
Convert every octal digit to 3 binary digits, then convert every 4 binary digits to1 hex digit (see conversion
tables):
734
=734
7= 111
3 = 011
4 = 100
= 1 1101 1100
1= 1
1101 = D
1100 = C
= 1DC
(734)8 =(1DC )16
1010) 1 1 1 0 0 1 1 (1011
1 0 1 0
1 0 0 0 1
1 0 1 0
0 0 1 1 1 1
1 0 1 0
0 1 0 1
Q=1011
R=101
(a) Write a program in QBASIC that allows user to enter radius of a circle. Create a user define
function to find the area of circle procedure to find volume of cylinder.
Hint: [A = * r ^ 2 * V = * r ^ 2 * h]
FUNCTION Area(R)
Area = PI * R ^ 2
END FUNCTION
SUB Volume(R, H)
V = PI * R ^ 2 * H
PRINT "Volume of the cylinder is: "; V
END SUB
(b) A sequential data file "employee.dat" contains address, age and salary of employee. WAP to
display all information whose address is 'Kathmandu' and salary is greater than 40000.
10. Write a program in C that asks a number and check whether it is positive, negative or zero.
#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;
}
Or,
Write a program in 'C' language that asks user to enter any number and check whether the number is
odd or even.
#include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 2 == 0) {
printf("The number is even.\n");
} else {
printf("The number is odd.\n");
}
return 0;
}
d) Write down the backslash character (Escape sequence) for horizontal tab and new line in C
program
The backslash escape sequences for horizontal tab is \t and fir new line is \n in C program.
(a) Network connecting device that boost the data signal. Repeater
(b) A code of behavtor for using Intermet Netiquette
(a) Define Network topology. Explain star topology with suitable diagram.
(d) What is online payment? Write the different forms of e-payment in Nepal?
Online Payment refers to the transfer of money or funds over the internet to purchase goods or services.
Forms of E-Payment in Nepal:
1. eSewa - A popular digital wallet for various transactions.
2. Khalti - A digital wallet for online payments and utility bill payments.
3. ConnectIPS - A payment gateway for transferring funds and making payments directly from bank
accounts.
4. IME Pay - A mobile payment system for transferring money and paying bills.
(9) What does date type used for? List out any four data types in MS-Access
Data Types are used in databases to define the kind of data that can be stored in a particular field, ensuring
data consistency and integrity.
Four Data Types in MS-Access:
1. Text - Used for storing alphanumeric data.
2. Number - Used for storing numerical data.
3. Date/Time - Used for storing date and time values.
2|P a g e CS SEE JEC BKT 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
4. Currency - Used for storing financial data with currency symbols.
SUB display(E$)
FOR I= 1 to LEN(E$) step 2
B$=MID$(A$,I,1)
PRINT B$;
NEXT I
END SUB
Debugged Program
DECLARE SUB great(p,q)
CLS
INPUT "Any two numbers”; a, b
CALL great (a, b)
END
(b) Write the name of String variable exist in file based on above program.
N$ and y$ are the string variable used in the above program.
Convert each hex digit to 4 binary digits and then convert each 3 binary digits to octal digits (see conversion
tables below):
BAD
=BAD
B= 1011
A =1010
D=1101
= 101 110 101 101
5= 101
6=110
5=101
5=101
= 5655
(BAD)16 into = (5655)8
1 1 0 0 1 0
1 1 0 0
0 0 0 0 0 0
0 0 0 0 0 0 x
1 1 0 0 1 0 x x
1 1 0 0 1 0 x x x
1 0 0 1 0 1 1 0 0 0
+ 1 1 0 1 0
1 0 0 1 1 1 0 0 1 0
101) 1 0 1 0 0 0 1 (10000
1 0 1
0 0 0 0 0 0 1
0
1
Q=10000
R=1
9. (a) WAP to Find area of Four walls using FUNCTION END FUNCTION and area of rectangle
using SUB END SUB
FUNCTION AOFW(l, b, h)
AOFW = 2 * h * (l + b)
END FUNCTION
SUB AOR(l, b)
A=l*b
PRINT "Area of the rectangle: "; A
END SUB
(ti) WAP to ask student's name, class and marks secured in three subjects. Store the data in a
sequential data file “result.dat” along with total marks. Make provision to ask user to enter another
record.
OPEN "result.dat" FOR OUTPUT AS #1
DO
INPUT "Enter student's name: ", N$
INPUT "Enter class: ", C$
INPUT "Enter marks in subject 1: ", M1
INPUT "Enter marks in subject 2: ", M2
INPUT "Enter marks in subject 3: ", M3
Total = M1 + M2 + M3
WRITE #1, N$, C$, M1, M2, M3, Total
INPUT "Do you want to enter another record? (Y/N): ", ans$
LOOP WHILE UCASE$(ans$) = "Y"
CLOSE #1
END
10. WAP to read two numbers and display the smaller one using C-Program
#include <stdio.h>
int main() {
int num1, num2;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
Or,
WAP to display the sum of first 10 natural numbers using C-Program.
#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;
}
v. Write the technical term: The arrangement of connection patterns of computers or nodes and
others resources. Network Topology
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 the type of data that can be stored in that field. If we enter text in a
numeric field then it display an error message indicating that the data type is incorrect.
Debugged Program
DECLARE FUNCTION PAL$ (W$)
CLS
INPUT "Enter a word"; W$
PRINT PAL$ (W$)
END
Dry Run
N F FOR I=1 to 5 F=F*I FACT=F PRINT FACT
(N)
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?
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
i. (1011011)2 × (110)2
Group ’B’ 12 x 2 = 24
4) Answer the following questions. 9 x2 =18
a) Differentiate between LAN and WAN.
Local Area Network is a network limited within a small area like a room, a building, school, college,
etc. generally connected through wire media.
LAN WAN
Local Area Network is a network limited Wide Area Network is a network that is extended to
within a small area like a room, a building, a large area i.e. whoke world in which computers
school, college, etc. generally connected are connected through wireless technology or
through wire media. media as satellite communication
The speed of LAN is high(more than The speed of WAN is slower than LAN.
WAN).
LAN is owned, managed, and used by an WAN can be either private or public. The Internet is
individual or an organization. Therefore, it the best example of public WAN.
is a private network.
The maintenance cost of LAN is easy. The maintenance cost of WAN is difficult.
h) What is query?
Query is an object of Ms-Access which extracts and arranges information from a table in a manner that is
specified.
Dry Run
Var. Var. O/P CONDITION
A X 3 10 5 16 8 4 A MOD 2=0
3 1 3 MOD 2=0
1=0 NO
10 2 10 MOD 2=0
0=0 YES
5 3 5 MOD 2=0
1=0 NO
16 4 16 MOD 2=0
0=0 YES
8 5 8 MOD 2=0
0=0 YES
4 6 4 MOD 2=0
0=0 YES
2 7 Loop terminates
The output of the program is
3 10 5 16 8 4
END
Debugged Program
REM to add more data in a sequential file.
OPEN “EMP.DAT” FOR APPEND AS #2
DO
INPUT “ENTER NAME”; N$
INPUT “ENTER ADDRESS”; A$
INPUT “ENTER SALARY”; S
WRITE #2, N$, A$, S
INPUT” Do you want to add more records.”; M$
3|P a g e CS SEE JEC BKT 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
LOOP WHILE UCASE$(M$) = “Y”
CLOSE #2
END
7) Study the given program and answer the given questions. [2]
DECLARE FUNCTION test$ (A$)
CLS
INPUT “ENTER ANY WORD”; T$
PRINT test$(t$)
END
FUNCTION test$ (A$)
FOR M = LEN(A$) TO 1 STEP -1
C$= C$+ MID$(A$, M,1)
NEXT M
Test$ = C$
END FUNCTION
a) List the formal and actual parameters used in the program given above.
Formal parameter= A$
Actual parameter = t$
b) List the library function used in the above program.
The library function used in the above program is LEN( ) and MID$( ).
FUNCTION AREA(R)
AREA = 3.14 * R ^ 2
END FUNCTION
10) A sequential data file “emp.dat” contains employee’s name, address, gender and salary. WAP to display
all the information of employees whose salary is more than Rs. 20,000
OPEN “emp.dat” FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
INPUT #1, N$, A$, G$, S
IF S>20000 then PRINT N$, A$, G$, S
WEND
CLOSE #1
END
11) Write a program in C language to input any two numbers and find greater number.
#include<stdio.h>
#include<conio.h> Write a program in C language that asks user
int main() to enter any number and check whether the
{ number is odd or even.
int a,b; #include<stdio.h>
printf("Enter any two numbers:\n "); #include<conio.h>
scanf("%d %d", &a, &b); int main()
if(a > b) {
printf("The greater number is %d", a); int n;
else printf("Enter any number: ");
printf("The greater number is %d", b); scanf("%d", &n);
return 0; if(n % 2 = = 0)
} printf("%d is even number", n);
else
printf("%d is odd number", n);
OR return 0;
}
a) What is an email?
Ans: E-mail is the most widely used service on the Internet which sends and receives messages
electronically through the Internet.
e) What is module?
Ans: Module is a block of statement that solves a particular problem.
Group - B
4. Answer the following questions.
a) Write any two advantages and disadvantages of computer network.
Ans: any two advantages of computer network are:
1. A network connected computers can share hardware devices such as scanner, printer, hard disk,
etc.
2. Networking also provides the facility of data and software backup system.
Any two disadvantages of computer network are:
1. Computer network can be route for computer virus and malware transmission.
2. Skilled manpower is required to manage and operate computer network.
b) What is digital footprint? Write any two tips to maintain digital reputation.
Ans: a digital footprint is a trail of data you create while using the internet.
1|P a g e CS SEE JEC BKT 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Any two tips to maintain digital reputation are:
i. Be transparent
ii. Respond to every review
c) What is password policy? Write any two important criteria for creating strong password.
Ans: A password policy defines the password strength rules that are used to determine whether a new
password is valid.
5. Write down the output of the given program. Show with the dry run in table.
DECLARE SUB SERI ( )
CLS
2|P a g e CS SEE JEC BKT 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
CALL SERI
END
SUB SERI
A$ = "SCIENCE"
B = LEN (A$)
FOR I = 1 TO 4
PRINT TAB(I); MID$(A$, I, B)
B =B-2
NEXT I
END SUB
DRY RUN TABLE:
A$ B = LEN (A$) I=1 TO 4 PRINT TAB(I); MID$(A$, I, B)
SCIENCE 7 1 TO 4 yes SCIENCE
5 2 TO 4 yes CIENC
3 3 TO 4 yes IEN
1 4 TO 4 yes E
-1 5 TO 4 No LOOP EXITS
OUTPUT:
SCIENCE
CIENC
IEN
E
CORRECT PROGRAM
6. Rewrite the given program after correcting the bugs. DECLARE FUNCTION REV (A)
Rem to convert the given number in reverse order CLS
DECLARE FUNCTION REV (A) INPUT "ENTER A NUMBER"; A
CLS RE=REV(A)
INPUT "ENTER A NUMBER"; A PRINT "REVERSE ="; RE
CALL REV (A) END
PRINT "REVERSE ="; RE FUNCTION REV (A)
END WHILE A<> 0
FUNCTION REV$ (A) R= A MOD 10
WHILE A<> 0 S = S * 10 + R
R= A MOD2 A = A \ 10
S = S * 10 + R WEND
A = A - 10 REV = S
WEND END FUNCTION
REV = S
END SUB
d) 1110 ÷ 110 = 10
Remainder: 10
10. Write a program to update the rate by increasing 10% from a sequential data file
"Data.dat" that store item name, rate and quantity.
OPEN "DATA.DAT" FOR INPUT AS#1
OPEN "TEMP.DAT" FOR OUTPUT AS #2
CLS
PRINT "DATA UPDATED BY INCREASING 10%"
PRINT "ITEM NAME", "RATE", "QUANTITY"
WHILE NOT EOF (1)
INPUT #1, N$, R, Q
R1 = R + 10/100 * R
WRITE #2, N$, R1, Q
WEND
CLOSE #1, #2
KILL "DATA.DAT"
NAME "TEMP.DAT" AS "DATA.DAT"
END
10. Write a program in c language to calculate simple interest.
#include <stdio.h>
#include <conio.h> Write a C program to find the sum
int main() of first 10 natural numbers.
{ #include <stdio.h>
float p, t, r, i; int main( )
printf("Enter the principal amount : "); {
scanf("%f", &p); int i, sum = 0;
printf("Enter the number of years : "); i = 1;
scanf("%f", &t); while (i <= 10) {
printf("Enter the rate of interest : "); sum += i;
scanf("%f", &r); ++i;
i = (p * t * r) / 100; }
printf("Simple Interest = %f", i); printf("Sum = %d", sum);
return 0; return 0;
} }
or
Solved BY: Saugat Basnet
Ans: char and int are any two data type used in C-programming.
i. List out the data type used for the following data in MS-Access
Student’ Name, Students’ Roll Number, Address, Fee paid
Ans: The data type used for the following data in MS-Access are:
Student’ Name – Text , Students’ Roll Number- Number , Address- Memo , Fee paid - Currency
2 to 7 2 MOD 2 <>0
yes 0<>0 No
3 to 7 3 MOD 2 <>0 nP+a
yes 1<>0 Yes nPa
ge
lle
Co
&
SS
n
ito
Tr
Debugged Program
REM display records of students from Data file
OPEN "Stdinfo.dat" FOR INPUT AS #1
PRINT "ROLL", NAME", "ADDRESS", "CLASS" , "SECTION"
DO WHILE NOT EOF (1)
INPUT #1, RN. N$, AD$, CL, S$
PRINT RN, NS, ADS, CL, S$
WEND
CLOSE #1
END
a. Write the names of two built in functions used in the above program.
Ans: LEN( ) and RIGHT$( ) are the two built in functions used in the above program.
ge
lle
Co
&
i) (315)10 → (?)2
Divide by the base 2 to get the digits from the remainders:
Division Quotient Remainder
by 2 (Digit)
(315)/2 157 1
(157)/2 78 1
(78)/2 39 0
(39)/2 19 1
(19)/2 9 1
(9)/2 4 1
(4)/2 2 0
(2)/2 1 0
(1)/2 0 1
= (100111011)2
(315)10 = (100111011)2
Q = 100
R = 11
b. Write a program to create a file “info.dat” and Store the name, address and mobile number of 5
peoples.
10. Write a program in C language to input a number and test whether it is odd or even. 4
#include<stdio.h>
#include<conio.h>
ge
lle
Co
int main()
&
SS
n
ito
Tr
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n % 2= =0)
printf("%d is even number", n);
else
printf("%d is odd number", n);
return 0;
}
OR,
Write a program in "C" language to display the series with their sum. 1,2,3,4….., up to 10th terms.
#include <stdio.h>
int main( )
{
int i, sum=0;
for(i = 1; i <= 10; i++)
{
printf("%d ", i);
sum += i;
}
printf("\nSum: %d", sum);
return 0;
}
SOLVED BY: DEEPAK SHRESTHA
SOLVED TRITON SEE MODEL QUESTIONS | OPT.II Computer Science
a. Define WIFI.
Wi-Fi is a technology that enables electronic devices to connect to the internet or communicate
wirelessly within a local area network (LAN).
Any two looping statements used in C language are for loop and while loop.
b. The process of identifying an individual usually based on username and password. Authentication
b. What is computer security? Write two software security measures to protect it.
Computer security refers to protecting computer and its content from damage, theft or misuse and action
to prevent such incidents.
Any two software security measures to protect it are password and backup.
f. List any four data types of MS-Access. Also, mention its function.
Any four data types of MS-Access and its function are:
Date/Time Used for dates and time data
Currency Used for currency values.
Auto Used for unique sequential (incrementing by 1).
ge
lle
Co
&
SS
n
ito
Tr
Number
Yes/No Used for data that can be only one of two
possible values, such as Yes/No (Boolean values)
Dry Run
Variable Condition PRINT A; A=A\10 C=C-1
Check
A C>=5
77777 5>=1 Yes 77777 77777 \10=7777 5-1=4
7777 4>=1 Yes 7777 7777\10=777 4-1=3
777 3>=1 Yes 777 777\10=77 3-1=2
77 2>=1 Yes 77 77\10=7 2-1=1
7 1>=1 Yes 7 7\10=0 1-1=0
0 0>=1 No
Loop Exits
The output of the program is:
77777 7777 777 77 7
ge
lle
Co
&
SS
n
ito
Tr
Debugged Program
Rem to store name, address in the file ' Shop.dat"
CLS
OPEN " Shop.dat" FOR OUTPUT AS #1
DO
INPUT" Enter name"; name$
INPUT " Enter address"; address
WRITE #1, name$, address$
INPUT " do you want to continue"; ans$
LOOP WHILE UCASE$(ans$) = "Y"
CLOSE #1
END
SOLVED BY: DEEPAK SHRESTHA
SOLVED TRITON SEE MODEL QUESTIONS | OPT.II Computer Science
7. Read the following program and answer the following questions. (2)
DECLARE SUB string (x$)
CLS
x$="KATHMANDU"
CALL string(x$)
END
SUB string(x$)
L=LEN(x$)
FOR A = L to 1 step -2
PRINT MID$(x$, A, 1);
NEXT A
END SUB
Questions:
a. What is the value of L in the above program?
The value of L in the above program is 9
0 0 0 0 0 0 × ×
Tr
1 0 1 0 1 0 × × ×
0 0 0 0 0 0 × × × ×
+ 1 0 1 0 1 0 × × × × ×
1 1 1 0 0 0 0 1 1 1 0
- 1 0 0 1 0 1
1 1 0 1 1 1 0 1 0 0 1
(101010) × (101011) – (100101)2 = (11011101001)2
b. 1001011 ÷ 10101
10101) 1 0 0 1 0 1 1 (11
- 1 0 1 0 1
1 0 0 0 0 1
- 1 0 1 0 1
0 0 1 1 0 0
Q = 11
R = 1100
c. (DEF42)16 = ( ? )8
Convert each hex digit to 4 binary digits
D = 1101
E = 1110
F = 1111
4 = 0100
2 = 0010
SOLVED BY: DEEPAK SHRESTHA
SOLVED TRITON SEE MODEL QUESTIONS | OPT.II Computer Science
Convert each 3 binary digits to octal digits.
= 11 011 110 111 101 000 010
011 = 3
011 = 3
110 = 6
111 = 7
101 = 5
000 = 0
010 = 2
= 3367502
(DEF42)16 = ( 3367502 )8
d. (489)10 = ( ? )2
Divide by the base 2 to get the digits from the remainders:
Division Quotient Remainder
by 2 (Digit)
(489)/2 244 1
(244)/2 122 0
(122)/2 61 0
(61)/2 30 1
(30)/2 15 0
(15)/2 7 1
(7)/2 3 1
(3)/2 1 1
(1)/2 0 1
= (111101001)2
(489)10 = ( 111101001 )2
ge
lle
Co
&
SS
n
ito
Tr
FUNCTION VOL(L,B,H)
VOL=L*B*H
END FUNCTION
SUB TSA(L,B,H)
T=2*(L*B+B*H+L*H)
PRINT”Total surface area of cuboid=”;T
END SUB
10. Write a program in C language that asks a number and check whether the number is positive,
negative or zero. (4)
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n>0)
ge
lle
Co
&
SS
n
ito
Tr
OR,
Write a program in C language to display the series with their sum 7, 10, 13, 16, …. up to 10th term.
#include<stdio.h>
int main()
{
int n=7, i, s=0;
for(i=1;i<=10;i++)
{
printf("%d ",n);
s=s+n;
n=n+3;
}
printf("\nsum= %d",s);
return 0;
}
SOLVED BY: DEEPAK SHRESTHA
SOLVED TRITON SEE MODEL QUESTIONS | OPT.II Computer Science
c. Which data types are used to store graphics and numeric characters in MS-Access?
OLE object is used for graphic and Number data type is used for numeric character
g. What does data type used for? List out any four data types in MS-Access.
Data type is used for determining the type of data that can be stored in that field.
Any four data types in MS-Access are: text, memo, number and currency.
DRY RUN
A$ B I =LEN (A$) to 1 B< > 3 PRINT MID$(A$,B,I) MID$(A$, 1, I) B=B+1
STEP-2 yes
no
NEPAL 1 5 to 1 YES 1 < > 3 YES NEPAL 1+1=2
2 3 to 1 YES 2 < > 3 YES EPA 2+1=3
3 1 to 1 YES 3 < > 3 NO N
4 7 TO 5 NO
LOOP EXITS
SOLVED BY: DEEPAK SHRESTHA
SOLVED TRITON SEE MODEL QUESTIONS | OPT.II Computer Science
OUTPUT
NEPAL
EPA
N
Debugged Program
SUB TEST(N)
Y=2
R=N MOD Y
IF R=0 THEN
PRINT"EVEN"
ELSE
PRINT"ODD"
END IF
END SUB
7. Study the following program and answer the given questions: (2x1=2)
OPEN"Detail.dat"FOR INPUT AS #1
OPEN"Temp.dat"FOR OUTPUT AS#2
INPUT "Enter name of the students";Sn$
FOR I = 1 TO 10
INPUT # 1, Nm$, CI, A
IF Sn$ < > Nm$ THEN
WRITE # 2, Nm$, CI, A
END IF
NEXT I
CLOSE #1, #2
KILL "Detail.dat"
NAME "Temp.dat"AS"Detail.dat"
END
b. Do you get any problem in the above program if "KILL" statement is removed? Give reason.
Yes, there would be a problem if the KILL statement is removed. Because without the KILL statement,
both Detail.dat and Temp.dat will exist, and the renaming (NAME "Temp.dat" AS "Detail.dat") will
fail because a file cannot be renamed to an existing file's name, causing an error and preventing the
update.
(ABC)16 = (5274)8
&
SS
n
ito
Tr
1 0 1
1 0 1
1 0 1
0 0 0 ×
1 0 1 × ×
1 1 0 0 1
101) 1 0 1 1 0 1 (1001
- 1 0 1
0 0 0 1 0 1
- 1 0 1
0 0 0
Q = 1001
ge
lle
Co
&
SS
n
ito
Tr
R=0
10. Write a program in C language to input a number then check whether the number is fully divisible
by 5 or not.
#include<stdio.h>
#include<conio.h>
int main()
ge
lle
Co
{
&
SS
n
ito
Tr
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n%5= =0)
printf("%d is divisible by 5",n);
else
printf("%d is not divisible by 5",n);
return 0;
}
OR,
Write a program in "C" language to display the series 2, 4, 6, 8 up to the 10th term.
#include<stdio.h>
int main()
{
int n=2, i;
for(i=1;i<=10;i++)
{
printf("%d ",n);
n=n+2;
}
return 0;
}
SOLVED BY: DEEPAK SHRESTHA
SOLVED TRITON SEE MODEL QUESTIONS | OPT.II Computer Science
c. What is IoT?
The Internet of Things (IoT) is a network of physical devices to exchange information over a network
without human intervention.
a. A device that is used to translate analog signals into digital and vice versa. MODEM
b. The smallest unit to represent information on a quantum computer. qubit (quantum bit)
e. Define online payment and list any two applications used for online payment.
Online payment refers to the payment for buying goods or services through the Internet using
different online payment gateway.Any two applications used for online payment are esewa and khalti.
ge
lle
Co
&
SS
n
ito
Tr
Dry Run
K$ K=1 TO C$=MI IS K MOD 2 YES NO X$=X$+C PRINT X$
LEN D$ = 1? C$=UCASE C$=LCA $
(K$) (K$, K, $ (C$) SE$
1) (C$)
KATHMAND 1 TO 9 K 1 MOD 2=1 k K
U YES NO
ge
lle
Co
&
SS
n
ito
2 TO 9 A 2 MOD 2=0 A kA
Tr
YES YES
3 TO 9 T t kAt
YES
4 TO 9 H H kAtH
YES
5 TO 9 M m kAtHm
YES
6 TO 9 A A kAtHmA
YES
7 TO 9 N n kAtHmAn
YES
8 TO 9 D D kAtHmAn
YES D
9 TO 9 U u kAtHmAn
YES Du
10 TO 9 kAtHmAn
NO Du
LOOP
EXITS
The output of the program is
kAtHmAnDu
Debugged Program
END
ito
Tr
FUNCTION vowel(S$)
c=0
FOR K=1 TO LEN (S$)
B$=MID$(S$, K, 1)
B$=LCASE$(B$)
SELECT CASE B$
CASE "a", "e", "i", "o", "u"
c=c+1
END SELECT
NEXT K
vowel = c
END FUNCTION
7. Study the following program and answer the given questions. (2)
DECLARE FUNCTION TEST (A)
X=10
Z=TEST (X)
PRINT Z
END
= (9647)₁₀
Co
&
SS
n
ito
Tr
(25AF)16 = (9647)10
(iii) 110110+100011
1 1 0 1 1 0
+ 1 0 0 0 1 1
1 0 1 1 0 0 1
110110+100011 = 1011001
Q = 10110
R = 11
9. (a) Write a program in QBASIC that asks length, breadth and height of a room and calculate its area and
volume. Create a User Defined Function to calculate Area and Sub Program to calculate the volume.
(b) 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
60,000.
ge
lle
Co
&
SS
n
ito
Tr
10. Write a program in 'C' language to find simple interest where user need 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;
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("\nsum= %d",s);
return 0;
}
ge
lle
Co
&
SS
n
ito
Tr
as different values.
c. How does password policy protect computer software and data? Explain in brief.
A password policy keeps computer software and data safe by ensuring users to create strong and
unique passwords. It helps stop unauthorized access, reduces security risks, and keeps the system
working properly.
e. Define e-banking and write one advantage and one disadvantage of e-banking.
E-banking is a digital banking system that allows customers to perform financial transactions and
manage their accounts online via the internet or mobile apps.
Any one advantage of e-banking is:
It saves the time of customers as they can easily access their account with the help of their device.
Any one disadvantage of e-banking is:
E-banking relies on internet connectivity and servers, so system failures or slow networks can disrupt
services.
Raw form of any facts, figures or entities are The processed form of data is known as information.
known as data.
For example, Aaradhya, 1000, account, For example, Aaradhya has 1000 balance in her bank
balance etc. are raw data individually does not account. Here Aaradhya, 1000, account, balance all have
give any meaning. their significant meaning.
7. Study the following program and answer the given questions. (2)
DECLARE FUNCTION prod (A,B)
CLS
INPUT"Enter first number";A
INPUT "Enter second number";B
PRINT"The product of the two number=";prod (A,B)
END
FUNCTION prod (A,B)
P=A*B
prod=P
END FUNCTION
Questions:
a. List all the numerical variables used in the program above.
The numerical variables used in the program above are A, B and P.
ge
lle
Co
&
SS
n
ito
Tr
(A4B)16 = (5113)8
(iii) (1011)2×(101)2+(1001)2
1 0 1 1
1 0 1
1 0 1 1
0 0 0 0 ×
1 0 1 1 × ×
1 1 0 1 1 1
ge
lle
Co
&
SS
n
ito
Tr
+ 1 0 0 1
1 0 0 0 0 0 0
(1011)2×(101)2+(1001)2 = (1000000)2
101) 1 0 1 1 1 (100
- 1 0 1
0 0 0
1 1
- 0
1 1
Q = 100
R = 11
(b) Write a program to create a file "info.dat" and Store the name, address and mobile number of
5 people.
FOR I = 1 TO 5
INPUT "Enter Name"; N$
INPUT "Enter Address"; A$
INPUT "Enter Mobile Number"; M#
WRITE #1, N$, A$, M#
NEXT I
CLOSE #1
END
10. Write a program in 'C' language to display the first 10 odd numbers.
#include <stdio.h>
int main( )
{
int i, a=1;
for(i = 1; i <= 10; i++)
{
printf("%d ", a);
a=a+2;
}
return 0;
}
Write a program in 'C' language to input two numbers and find the greatest among two numbers.
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b;
printf("Enter any two numbers:\n ");
scanf("%d %d", &a, &b);
if(a>b)
printf("The greater number is %d", a);
else
printf("The greater number is %d", b);
return 0;
}
Best of Luck
ge
lle
Co
&
SS
n
ito
Tr
c) What is Wi-Fi?
Wi-Fi is a wireless technology that provides high-speed internet
and network access using radio waves.
FUNCTION PRO(A,B) or
PRO = A * B Write a program to count the occurrence of letter 'e' in the
END FUNCTION supplied string using SUB…END SUB.
DECLARE SUB COUNT (S$)
b) WAP to find sum of digits of a number using SUB….END CLS
SUB. [Hint: 456: 4+5+6=15] INPUT "ENTER ANY STRING"; S$
DECLARE SUB SUM (N) CALL COUNT(S$)
CLS END
INPUT "ENTER ANY NUMBER"; N
CALL SUM (N) SUB COUNT (S$)
END EC = 0
FOR I = 1 TO LEN(S$)
SUB SUM (N) B$ = MID$(S$, I, 1)
S=0 C$ = UCASE$(B$)
WHILE N < > 0 IF C$ = "E" THEN EC = EC + 1
R = N MOD 10 NEXT I
S=S+R PRINT "TOTAL NO. OF LETTER E = "; EC
N = N \ 10 END SUB
WEND
PRINT "SUM OF DIGITS="; S
END SUB
Symbol No: ……………………… 2081-03-27 10:00am 2081-03-27 10:00am
PABSON Kathmandu 2. Write appropriate technical term for the following: (21=2)
FIRST TERMINAL EXAMINATION-2081 a) A group of computers that functions both as a client and server.
Peer to Peer Network
Subject: Opt. II Computer Science Full Marks: 50
Class: 10 Time: 2 hrs. b) The unauthorized duplication and use of computer software.
Candidates are required to answer the questions in their own way words as far as Software Piracy
practicable. Figures in the margin indicate the full marks.
3. Write the full form of the following: (21=2)
Attempt all questions. a) URL – Uniform Resource Locator
b) ICT - Information and Communication Technology
Group ‘A'
Group ‘B'
1. Answer the following questions in one sentence: (61=6)
4. Answer the following questions: (92=18)
a) What is an uploading?
Upload is the process of transferring files or data from user’s a) Write any two advantages and disadvantages of computer
computer or device to a remote server or another device. network.
Any two advantages of computer network are:
b) Write few popular ISP's of Nepal. ❖ Users can share resources like hardware (printers) and
Mercantile and Wlink, are few popular ISP’s of Nepal software (applications) across the network.
❖ Allows users to easily share and access files from different
c) List any two examples of cybercrimes. computers.
Ay two cybercrimes are phishing and hacking. Any two disadvantages of computer network are:
d) List any two services of internet. ❖ Networks can be hacked, leading to loss or theft of important
Any two services of internet are E-Mail and E-Commerce. data.
❖ Keeping a network running smoothly can be expensive and
e) What is local variable in QBASIC? requires regular updates.
A variable which is defined in a module and is not accessible
to any other module is called local variable. b) What is network connecting device? Write any two of them.
A network connecting device is hardware that connects
f) Which statement is used to call FUNCTION and SUB computers and devices to enable communication, data sharing,
procedure? and resource access. Any two network connecting devices are
A SUB procedure is called using the CALL statement. router and switch.
A FUNCTION procedure is called using its name in an
expression or an assignment statement.
Symbol No: ……………………… 2081-03-27 10:00am 2081-03-27 10:00am
c) What is data communication mode? List its type. It is necessary in E-commerce to provide legal framework to
Data transmission mode is the way of transmission of data from facilitate and safeguard electronic transaction in the electronic
one location to another. media.
Its types are:
Simplex mode is the transmission of data and information that h) Differentiate between SUB and FUNCTION procedure.
takes place in only one direction. Sub procedure Function procedure
Half-duplex is the transmission of data and information that flows Sub procedure name cannot have Function procedure name not
in both directions but only one direction at a time type declaration sign have type declaration sign
Full duplex mode is the transmission of data and information that Sub procedure does not return Function procedure returns value
flows in both direction simultaneously on the transmission path value to calling module to the calling module
Or
SOLVED National PABSAN COMPUTER SCIENCE SEE Pre Board Examination-2081
Time: 2:00 Hours
Full Marks: 50
GROUP 'A'
1. Answer the following questions:
d. What is report?
Report is one of the MS-Access database objects used to present information in an effective and organized
format that is ready for printing.
GROUP 'B'
4. Answer the following questions:
Debugged Program
DECLARE FUNCTION SQ (N)
CLS
FOR N=1 TO 10
PRINT SQ (N)
NEXT N
END
FUNCTION SQ (N)
SQ=N^2
END FUNCTION
7. Study the following program and answer the given questions: 2x1=2
DIM N (10)
DECLARE SUB MIN (N ( ))
CLS
FOR I=1 TO 10
INPUT "ENTER A NUMBER"; N (I)
NEXT I
CALL MIN (N ( ))
END
SUB MIN (N ())
S=N (1)
FOR 1=2 TO 10
IF SN > N(I) THEN S=N (I)
NEXT I
PRINT "THE SMALLEST NUMBER=”;S
END SUB
b. (101111)2=(?)8
с. (101001) x (101)
1 0 1 0 0 1
x 1 0 1
1 0 1 0 0 1
0 0 0 0 0 0 x
1 0 1 0 0 1 x x
1 1 0 0 1 1 0 1
(101001) x (101) = (11001101)
d. (1101110) / (1101)
1101) 1 1 0 1 1 1 0 (1000
1 1 0 1
0 0 0 0 1 1 0
0
1 1 0
Q=1000
R=110
FUNCTION MTC(M)
MTC = M * 100
END FUNCTION
SUB MTM(M)
MM = M * 1000
PRINT "Length in millimeter is: "; MM
END SUB
b. Write a program to read records from file name "Rec.dat" and display all the records those post is
manager. File contains field names are employees Name, Post, Date of birth, e-mail address and
Salary.
OPEN “Rec.dat” FOR INPUT AS #1
CLS
PRINT “Name”, “Post”, “Date of Birth”, “E-Mail”, “Salary”
WHILE NOT EOF(1)
INPUT #1, N$, P$, D$, E$, S
IF UCASE$(P$) = “MANAGER” THEN PRINT N$, P$, D$, E$, S
WEND
CLSOE #1
END
10. Write a program in C-language that ask length, breadth and height then display volume of box. 4
[Hint: volume=LxBxH]
#include <stdio.h>
int main( )
{
float length, breadth, height, volume;
printf("Enter the length of the box: ");
scanf("%f", &length);
printf("Enter the breadth of the box: ");
scanf("%f", &breadth);
printf("Enter the height of the box: ");
scanf("%f", &height);
volume = length * breadth * height;
printf("The volume of the box is: %.2f\n", volume);
return 0;
}
Or
Write a program in C-language to display the series 5, 10, 15, 20, 25 up to 10th term.
#include <stdio.h>
int main( )
{
int i, term;
a. What is bandwidth?
Bandwidth is the maximum amount of data that can be transmitted over a network or communication
channel in a given amount of time.
d. While designing table structure, which data types are suitable to store information about a
student’s name and class?
The suitable data type to store student’s name is text and class is number.
GROUP 'B'
4. Answer the following questions:
b. Mention any two threats and two opportunities of using social media.
Opportunities of using social media
Networking: Connect globally, build relationships, and join communities.
Marketing and Branding: Promote businesses and engage with customers.
Threats of using social media
Privacy Risks: Personal information can be exposed or misused.
Cyberbullying: Harassment or bullying through online interactions.
c. What is hardware security? List any two software security measures.
Hardware security refers to the protection of the physical components of a computer or electronic device
from unauthorized access, theft, or damage.
Any two software security measures are password and backup.
5. Write down the output of the given program and show them in dry run table:
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES ( )
X=1
Y=1
FOR P = 1 TO 10
PRINT X;
X=X+Y
Y=Y+1
NEXT P
END SUB
Dry Run Table
X Y P = 1 TO 10 PRINT X; X=X+Y Y=Y+1
1 1 1 TO 10 Yes 1 1+1=2 1+1=2
2 2 2 TO 10 Yes 2 2+2=4 2+1=3
4 3 3 TO 10 Yes 4 4+3=7 3+1=4
7 4 4 TO 10 Yes 7 7+4=11 4+1=5
11 5 5 TO 10 Yes 11 11+5=16 5+1=6
16 6 6 TO 10 Yes 16 16+6=22 6+1=7
22 7 7 TO 10 Yes 22 22+7=29 7+1=8
29 8 8 TO 10 Yes 29 29+8=37 8+1=9
37 9 9 TO 10 Yes 37 37+9=46 9+1=10
46 10 10 TO 10 Yes 46 46+10=56 10+1=11
56 11 11 TO 10 No
Loop Exits
The output of the Program is:
1 2 4 7 11 16 22 29 37 46
FUNCTION TEST$(N)
R = R MOD 2
IF R = 0 THEN
A$= “EVEN”
ELSE
A$ = “ODD”
END IF
A$ = TEST$
END FUNCTION
Debugged Program
REM TO CHECK ODD OR EVEN NUMBERS.
DECLARE FUNCTION TEST$(N)
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "THE NUMBER IS "; TEST$(N)
END
FUNCTION TEST$(N)
R = N MOD 2
IF R = 0 THEN
A$ = "EVEN"
ELSE
A$ = "ODD"
END IF
TEST$ = A$
END FUNCTION
7. Study the following program and answer the given questions: 2x1=2
DECLARE FUNCTION SUM (N)
CLS
INPUT “ENTER MULTIDIGIT NUMBER”; A
SU = SUM(A)
PRINT “SUM OF DIGITS”; SU
END
FUNCTION SUM(N)
S=0
WHILE N < > 0
R = N MOD 10
S=S+R
N = N \ 10
WEND
SUM = S
END FUNCITON
b. List the formal and real parameters used in the above program.
The formal parameter is N and real parameter is A.
(101101)₂
= (1 × 2⁵) + (0 × 2⁴) + (1 × 2³) + (1 × 2²) + (0 × 2¹) + (1 × 2⁰)
=1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1
=32+0+8+4+0+1
(101101)10 = (45)₁₀
b. (BAD)16=(?)8
с. (1101) x (101)
1 1 0 1
x 1 0 1
1 1 0 1
0 0 0 0 x
1 1 0 1 x x
1 0 0 0 0 0 1
(1101) x (101) = (11000001)
d. (10100) / (11)
11) 1 0 1 0 0 (110
1 1
1 0 0
1 1
1 0
0
1 0
Q=110
R=10
FUNCTION SMALL(A,B,C)
IF A<B AND A<C THEN
SMSLL=A
ELSEIF B<A AND B<C THEN
SMALL=B
ELSE
SMALL=C
END IF
END FUNCTION
SUB GREAT(A,B,C)
IF A>B AND A>C THEN
PRINT"THE GREATEST NUMBER IS ";A
ELSEIF B>A AND B>C THEN
PRINT"THE GREATEST NUMBER IS ";B
ELSE
PRINT"THE GREATEST NUMBER IS ";C
END IF
END SUB
b. A sequential data file "student.txt" has stored data under the field heading Roll
No ., Name, Gender, marks of English , Nepali and Computer . Write a program to
display all the information of those student whose gender is 'F' and obtained marks
in computer is more than 90 .
OPEN "student.txt" FOR INPUT AS #1
CLS
WHILE NOT EOF (1)
INPUT #1, RN, SN$, G$, E, N, C
IF UCASE$(G$) = “F” AND C >90 THEN PRINT RN, SN$, G$, E, N, C
WEND
CLOSE #1
END
10. Write a C language that asks a number and check whether it is odd or even.
#include<stdio.h>
#include<conio.h>
int main( )
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n % 2 = = 0)
{
printf("%d is even number", n);
}
else
{
printf("%d is odd number", n);
}
return 0;
}
Or
Write a C language to display the following series:
1, 3, 5, 7……….up to 10th terms.
#include <stdio.h>
int main( )
{
int i, a=1;
d. What is Filtering?
Filtering is the process of viewing required record of a table that matches the specified criteria.
Group "B"
4. Answer the following questions:
5. Write down the output of the given program. Show with dry-run in table.
CLS
P=1: Q=1
CALL DISP(P,Q)
END
SUB DISP(M,N)
WHILE (N<=5)
PRINT M
M=M*10+N
N=N+1
WEND
END SUB
Debugged Program
REM To display some records from data file "info.dat"
CLS
OPEN "INFO.DAT” FOR INPUT AS #1
PRINT "Roll , "Name", "English"."Nepali", "Maths"
DO WHILE NOT EOF(1)
INPUT #1,RN,N$,E,N,M
PRINT RN,N$.E,Ne,M
LOOP
CLOSE #1
END
Group "C"
8. Convert/calculate as per the instruction:
a. (10101011)2 = (?)16
Convert every 4 binary digits (from bit0) to hex digit :
10101011
= 1010 1011
1010= A
1011 = B
= AB
(10101011)2 = (AB)16
b. (641)10 = (?)2
Divide by the base 2 to get the digits from the remainders:
Division Quotient Remainder
by 2 (Digit)
(641)/2 320 1
(320)/2 160 0
(160)/2 80 0
(80)/2 40 0
(40)/2 20 0
(20)/2 10 0
(10)/2 5 0
(5)/2 2 1
(2)/2 1 0
(1)/2 0 1
= (1010000001)2
(641)10 = (1010000001)2
c. (1010) x (11) - (101)
1 0 1 0
x 1 1
1 0 1 0
1 0 1 0 x
1 1 1 1 0
d. (101101) / (110)
110) 1 0 1 1 0 1 (111
1 1 0
1 0 1 0
1 1 0
1 0 0 1
1 1 0
1 1
Q = 111
R = 11
9. a. Write a program in QBASIC that asks for the radius and height of a cylinder and calculates its
surface area and volume. Create a user-defined function to calculate the surface area and a sub-
program to calculate the volume. Hint: Surface Area=2*pi*r* (r+h). Volume pi*r^2*h]
DECLARE FUNCTION TSA(R,H)
DECLARE SUB VOL(R,H)
CLS
INPUT “ENTER THE RADIUS”;R
INPUT “ENTER THE HEIGHT”;H
PRINT “THE TSA OF CYLINDER IS ”;TSA(R,H)
CALL VOL(R,H)
END
FUNCTION TSA(R,H)
TSA = 2*3.14*R*(R+H)
END FUNCTION
SUB VOL(R,H)
V = 3.14*R^2*H
PRINT “THE VOLUME OF CYLINDER IS ”; V
END SUB
b. A sequential data file called "Employee.txt" has stored data under the field headings Employee ID,
Name, Gender, Department, and Salary. Write a program to display all the information of those
employees whose salary is greater than 50,000 and the department is "IT".
10. Write a program in C language that asks three integer number and display smallest among three
numbers
OR
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("Enter any three numbers:\n ");
scanf("%d %d %d" , &a, &b, &c);
if(a<b && a<c)
printf("The smallest number is %d", a);
else if(b<a && b<c)
printf("The smallest number is %d", b);
else
printf("The smallest number is %d", c);
return 0;
}
Write a program in C language to display reverse of an multi digit integer input number.
#include<stdio.h>
#include<conio.h>
int main()
{
int n, s, r;
s=0;
printf("Enter any number: ");
scanf("%d", &n);
while(n>0)
{
r=n%10;
s=s*10+r;
n=n/10;
}
printf("Reverse digits= %d",s);
return 0;
}
***The End***
SEE Efficiency Test: 2025
Subject: Computer Science
Time: 2:00 hrs
Full Marks: 50
Candidates are required to give their answers in their own words as far as practicable.
GROUP A
b) Define Firewall.
Ans: A firewall is a security system that monitors and controls incoming and outgoing network traffic to
protect systems from unauthorized access and cyber threats.
d) What is M-Commerce ?
Ans: M-commerce refers to the buying and selling of goods and services through mobile devices like
smartphones and tablets.
a) The specific computer or specific internet location that delivers the web contents to the client devices via
internet. Web Server
b) The software intentionally designed to cause to a computer, server, client, or computer network, leak
private information, gain unauthorized access to information or system. Malware
GROUP-B
(Short Questions-24 Marks)
Answer the following questions: (9×2=18)
g) While designing table structure which data types are suitable to store information about teacher's
name, address, salary and date of birth?
Ans: Teacher’s Name – Text
Addess – Memo
Salary – Currency
Date of bith – Date/Time
SUB DISPLAY
LET N = 100
DO UNTIL N < 50
R=N MOD 9+3
IF R MOD 4=0 THEN GOTO BOTTOM
PRINT R
BOTTOM:
N=N-10
LOOP
END SUB
Dry Run
N N < 50 R=N MOD 9+3 R MOD 4=0? NO YES
PRINT R N=N-10
100 100<50 No 100 MOD 9 + 3 4 MOD 4=0? 100-10=90
1+3=4 0=0 YES
REM to count total number of values existing among a different number input by a user DIVISIBLE BY 3.
DECLARE FUNCTION DIVBY3 (a( ), n)
CLS
FOR CNT=0 TO n-1
INPUT "Enter the number"; a(n)
NEXT CNT
Totno=DIVBY3 (a, n)
FUNCTION DIVBY3( )
count=0
FOR CNT=0 to n-1
IF a(CNT) MOD 3=0 THEN count=count+1
NEXT CNT
COUNT=DIVBY3
END FUNCTION
Debugged Program
REM To count the total number of values divisible by 3 among numbers input by the user.
DECLARE FUNCTION DIVBY3 (a( ), n)
CLS
INPUT "Enter the number of values: "; n
DIM a(n)
Totno = DIVBY3(a( ), n)
b) Do you get any problem in above program if "Kill" statement is removed? Give reason.
Ans: Yes, the program will not work correctly because the original file "BUSRIDER.TXT" will not be deleted,
and renaming "TEMP.TXT" to "BUSRIDER.TXT" will fail due to the existence of the original file.
GROUP-C
a) (101101) X (1110)2-(10101)
1 0 1 1 0 1
x 1 1 1 0
0 0 0 0 0 0
1 0 1 1 0 1 x
1 0 1 1 0 1 x x
1 0 1 1 0 1 x x x
1 0 0 1 1 1 0 1 1 0
- 1 0 1 0 1
1 0 0 1 1 0 0 0 0 1
(101101) X (1110)2-(10101) = (1001100001)
b) (11011010) / (10101)
10101) 1 1 0 1 1 0 1 0 (1010
1 0 1 0 1
0 0 1 1 0 0 1
1 0 1 0 1
0 0 0 0 1 0 0 0
0
1 0 0 0
Q=1010
R=1000
c) (DEF86)16= (?)8
Convert each hex digit to 4 binary digits
DEF86
=DEF86
D= 1101
E = 1110
F = 1111
8 = 1000
6 = 0110
3= 011
3 = 011
6 = 110
7 = 111
6 = 110
0 = 000
6 = 110
=3367606
(DEF86)16= (3367606)8
d) (872)10 = (?)2
Divide by the base 2 to get the digits from the remainders:
Division Quotient Remainder
by 2 (Digit)
(872)/2 436 0
(436)/2 218 0
(218)/2 109 0
(109)/2 54 1
(54)/2 27 0
(27)/2 13 1
(13)/2 6 1
(6)/2 3 0
(3)/2 1 1
(1)/2 0 1
= (1101101000)2
(872)10 = (1101101000)2
9.
a) Write a QBASIC program that asks radius and height then calculate Area of curved surface and Total
surface area. Create a USER DEFINED FUNCTION to calculate Total surface area and SUB-PROGRAM to
calculate Area of curved surface. [Hint: TSA=2pir(r + h) and AOCS=2pir²] (4)
b) A sequential data file "Reverse. Txt" contains name of the 20 teachers. Write a QBASIC program to
display name of the teachers in Reverse form. (4)
CLS
DIM teachers(20) AS STRING
OPEN "Reverse.Txt" FOR INPUT AS #1
FOR i = 1 TO 20
LINE INPUT #1, teachers(i) ' Read teacher names into an array
NEXT i
CLOSE #1
END
10. Write a program in C language that asks the value of 3 sides of a triangle then check whether triangle is
Scalene or not. (4)
#include <stdio.h>
int main()
{
int a, b, c;
printf("Enter three sides of a triangle: ");
scanf("%d %d %d", &a, &b, &c);
if (a != b && b != c && a != c) {
printf("The triangle is Scalene.\n");
} else {
printf("The triangle is not Scalene.\n");
}
return 0;
}
OR
Write a program in C language to display the odd numbers from 1000 to 500 with their sum.
#include <stdio.h>
int main()
{
int sum = 0;
for (int i = 1000; i >= 500; i--)
{
if (i % 2 != 0)
{
printf("%d\n", i);
sum += i;
}
}
printf("Sum of odd numbers: %d\n", sum);
return 0;
}
"Good Luck"
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
SEE Model Question Issued by CDC
Opt. II Computer Science
F.M. : 50
Group ‘A’ (10 Marks)
c) Which data type is used to store alpha numeric characters or special symbols in MS-Access?
The text data type is used to store alpha numeric characters or special symbols in MS-Access.
i. What type of work is done in MS-Access using form and query object.
• Form provides graphical interface to view, modify and add data in a table or multiple linked tables.
• Query is used to view, retrieve, change and analyze records from a table or multiple linked tables
based on specified condition.
5. Write the output of the given program: Show with dry run in table. [2]
DECLARE SUB SHOW(A)
CLS
N=87
CALL SHOW(N)
2|P a g e SET SOLUTIONS https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
END
SUB SHOW(A)
DO
B=A MOD 6+3
IF B MOD 4=0 THEN GOTO AA
PRINT B;
AA:
A=A-10
LOOP WHILE A>=50
END SUB
b. Do you get any problem in the above program if “Kill” statement is removed? Give reason.
Yes, there would be a problem if the KILL statement is removed. Because without the KILL
statement, both Detail.dat and Temp.dat will exist, and the renaming (NAME "Temp.dat" AS
"Detail.dat") will fail because a file cannot be renamed to an existing file's name, causing an error and
preventing the update.
8. Convert / Calculate as per the instruction. [4×1=4]
a. (11001101)2 = (?)16
Soln:
Converting Binary to octal
Binary 1100 1101
value in
four bits
Octal C D
number
(11001101)2 = (CD)16
b. (524)10 = (?)2
Soln:
Remainder
2 524
2 262 0
2 131 0
2 65 1
2 32 1
2 16 0
2 8 0
2 4 0
2 2 0
2 1 0
2 0 1
(524)10 = (1000001100)2
1 0 1 0
× 1 1 0
4|P a g e SET SOLUTIONS https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
0 0 0 0
1 0 1 0 ×
+ 0 1 0 × ×
1
1 1 1 1 0 0
- 1 0 1 1
1 1 0 0 0 1
d. (10110)2 ¸ (101)2
101) 1 0 1 1 0 (100
- 0 1
1
0 0 0 1 0
-
0
1 0
Quotient=100
Remainder=10
9. a. 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
volume. Hint: [A=L×B], [V=L×B×H]
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
b. A sequential data file called “Record.txt” has stored data under the field heading Roll No.,
Name, Gender, English, Nepali, Maths and Computer. Write a program to display all the
information of those students whose gender is “F” and obtained marks in computer is more
than 90.
10. Write a program in C language that asks a number and check whether it is odd or even.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n % 2 = = 0 )
printf("%d is even number", n);
else
printf("%d is odd number", n);
return 0;
}
OR
Write a program in C language to display the series with their sum.1, 2, 3, 4 upto 10th terms.
#include<stdio.h>
#include<conio.h>
int main()
{
int i, s=0;
i=1;
while(i<=5)
{
printf("%d \n", i);
s = s + i;
i++;
}
print("%d \n Sum=", s);
return 0;
}
Group 'A'
1. Answer the following questions in one sentence:
c. Which type of query do you use to calculate the total marks of students from table in MS Access?
Ans: Select Query is used to calculate the total marks of students from table in MS Access
f. Which format specifier do you use in C language for 'int' data type ?
Ans: %d format specifier is used in C language for 'int' data type.
b) What is cyber ethics? Write any two commandments for using computer.
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.
Any two commandments for using computer are:
❖ Do not use a computer to publish fake information.
❖ Do not search the file or record of other people.
https://seeqbasicomputer.blogspot.com/ https://deepak2081.com.np/
SEE (Grade Increment) 2080 (2024) [SOLVED] – Solved By: Deepak Shrestha
e) What is social media? Write any one reason why it is popular now days.
Social media are online platforms like Facebook, Twitter, and Instagram that let users create, share, and
interact with content while connecting with others.
It's popular now a days because it enables instant communication, allowing people to connect and share
information globally in real-time.
5. Write down the output of the given program and show them in dry run table.
DECLARE FUNCTION Series (N)
CLS
A=2
PRINT "Sum of the series"; Series (A)
END
Corrected Program:
REM to display name, post and salary of 10 employees
OPEN "EMP.TXT" FOR INPUT AS #1
FOR I=1 TO 1 0
INPUT #1, Name$, Post$, Salary
PRINT Name$, Post$, Salary
NEXT I
CLOSE #1
END
Convert every 3 binary digits (from bit0) to octal digit (see conversion table below):
10011011
010 = 2
011 = 3
011 = 3
=233
= (10011011)2 = (233)8
1 0 1 1 0
x 1 0 1
1 0 1 1 0
0 0 0 0 0 x
1 0 1 1 0 x x
1 1 0 1 1 1 0
11) 1 0 1 1 0 1 (1111
- 1 1
1 0 1
1 1
1 0 0
1 1
1 1
1 1
0 0
Q = 1111
R=0
https://seeqbasicomputer.blogspot.com/ https://deepak2081.com.np/
SEE (Grade Increment) 2080 (2024) [SOLVED] – Solved By: Deepak Shrestha
9. a) Write a program in QBASIC that asks radius and height of a cylinder Create a User Defined
Function to calculate total surface area and a Sub Program to calculate the volume of a cylinder.
[Hint: TSA=2r (r+h) and Volume r2h]
b) Write a program to create a sequential data file "student.dat" to store 10 students name and obtain
marks in four different subjects.
10. Write a program in C language that asks for an integer value and checks whether it is divisible by
7 or not.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n%7==0)
printf("%d is divisible by 7",n);
else
printf("%d is not divisible by 7",n);
return 0;
https://seeqbasicomputer.blogspot.com/ https://deepak2081.com.np/
SEE (Grade Increment) 2080 (2024) [SOLVED] – Solved By: Deepak Shrestha
}
OR
Write a program in C language to display the series with their sum 1, 4, 9, 16.... up to 10th term.
#include <stdio.h>
int main( )
{
int i, t, s = 0;
printf("Series: ");
for (i = 1; i <= 10; i++)
{
t = i * i;
printf("%d ", t);
s += t;
}
printf("\nSum of the series: %d\n", s);
return 0;
}
***
https://seeqbasicomputer.blogspot.com/ https://deepak2081.com.np/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
a) A secret group of characters used to protect computer system from unauthorized users. Password
b) An artificial environment created by a computer system that appears real. Virtual reality
c) 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: Firewall and Cryptography
h) Give the differences between the Select Query and Action Query.
Debugged Program
DECLARE SUB Square (A)
REM to print square of a input number
CLS
INPUT "Enter a number"; N
CALL Square (N)
END
b) 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'
8. Convert/Calculate as per the instruction:
a) (ABC)16 = (?)8
Convert each hex digit to 4 binary digits
ABC
=ABC
A = 1010
B = 1011
C = 1100
= 101010111100
Convert every 3 binary digits (from bit0) to octal digit
101010111100
= 101 010 111 100
101 = 5
010 = 2
111 = 7
100 = 4
= 5274
(ABC)16 = (5274)8
b) (435)10 = (?)2
Division by 2 Quotient Remainder(Digit)
(435)/2 217 1
(217)/2 108 1
(108)/2 54 0
(54)/2 27 0
(27)/2 13 1
(13)/2 6 1
(6)/2 3 0
(3)/2 1 1
(1)/2 0 1
= (110110011)2
(435)10 = (110110011)2
4|P a g e CS SEE 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
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
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
9a) 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]
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
10. 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;
}
b) What is Ecommerce?
Ans: E-commerce refers to the buying and selling of goods and services over the internet.
e) What is looping?
Ans: Looping is the process of repeating the execution of a statement or a block of statements until a
specific condition is satisfied.
d) Define virtual reality. Write any two areas where virtual reality is used.
30 2 to 5 yes 30 30+10=40
40 3 to 5 yes 40 40+10=50
50 4 to 5 yes 50 50+10=60
60 5 to 5 yes 60 60+10=70
70 6 to 5 no
Loop exits
Debugged Program
REM program to make a word reverse
DECLARE FUNCTION Rev$(N$)
CLS
INPUT “Enter a word”; N$
PRINT “Reversed is”; Rev$(N$)
END
FUNCTION Rev$(N$)
FOR K=LEN (N$) To 1 STEP-1
B$=B$+MID$(N$,K,1)
NEXT K
Rev$=B$
END FUNCTION
b) (410)10 = (?)2
2 410 Remainder
2 205 0
2 102 1
2 51 0
2 25 1
2 12 1
2 6 0
2 3 0
2 1 1
2 0 1
(410)10 = (110011010)2
d) (10110)2 (101)2
4|P a g e CS SEE 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Quotient = 100
Remainder = 10
9. a) 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= r2, C= 2r]
b) A sequential data file called “Record.dat” has stored data under the field headings: Roll No., Name,
Gender, English, Nepali, Maths and Computer. Write a program to display all the information of
those students whose marks in English is more than 40.
#include<stdio.h>
#include<conio.h>
int main( )
{
int a,b;
printf("Enter any two numbers:\n ");
scanf("%d %d", &a, &b);
if(a>b)
printf("The greatest number is %d", a);
else
printf("The greatest number is %d", b);
return 0;
}
OR
Write a program in C-Langauge to display the series with their sum. 1,2,3,4….upto 10th terms.
#include <stdio.h>
int main()
{
int j, sum = 0;
printf("The first 10 natural number is :\n");
for (j = 1; j <= 10; j++)
{
sum = sum + j;
printf("%d ",j);
}
printf("\nThe Sum is : %d\n", sum);
}
***
उपयुक्त प्राद्विद्वधक शब्द लेख्नुहोस् : Write appropriate technical term for the following: (२×१=२)
(क) कम्प्युटर नेटिाक भनेको के हो ? यसका कुनै िु ईओटा महत्त्वहरू सूचीकृत गनुाहोस् ।
What is computer network? List any two importance of it.
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 importance of computer network are:
• A network connected computers can share hardware devices such as scanner, printer, hard disk, etc.
• It also provides the facility of data and software backup system.
(ङ) आद्वटा द्विद्वसयल इन्टे द्वलर्ेन्स (AI) को पररभाषा लेख्नुहोस् । AI को कुनै िु ईओटा प्रयोगहरू लेख्नुहोस् ।
Define artificial intelligence (AI). Write any two uses of AI.
Ans: Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are
programmed to think and learn like humans.
Any two uses of AI are
· AI can be used to detect fraud in financial transactions, such as credit card fraud.
· AI can be used to diagnose diseases more accurately and efficiently than humans can.
(छ) एम्. एस्. एक्सेसमा ररपोटा भनेको के हो ? डे टाबेसमा ररपोटा को महत्त्व लेख्नुहोस् ।
What is report in MS-Access? Mention the importance of report in database.
Ans: Report is an object of Ms-Access which displays the output in an effective way to present the data in a
printed format.
Importance of report is to print documents according to user’s specifications of the summarized information
through query or table.
(ि) द्वनम्न ताद्वलका संरचनामा प्रयोग भएको field name and records उल्लेख गनुाहोस् : List the field name
and records used in the following table structure.
Symbol_No Name Marks
001009010 Hari Thapa 85
00100901Q Binu Sharma 91
Ans:
Field Names = Symbol_No, Name and Marks
Record 1= 00100900P Hari Thapa 85
Record 2 = 00100901Q Binu Sharma 91
Output
CMUE
तल द्विइएको प्रोग्राममा रहेका गल्तीहरूलाई सच्याएर पुनः लेख्नुहोस् :
Rewrite the given program after correcting the bugs:
REM to display records from existing file.
OPEN "emp.text" FOR APPEND AS #1
WHILE NOT EOF (#1)
WRITE # 1, eN$, posts, salaryS
PRINT eN$, post$, salary
NEXT
CLOSE #1
END
Debugged Program
REM to display records from existing file.
OPEN "emp.txt" FOR INPUT AS #1
WHILE NOT EOF (1)
INPUT # 1, eN$, posts, salary$
PRINT eN$, post$, salary
WEND
CLOSE #1
END
(214) 10 = (11010110)2
iii) (1011)2×(101) 2
1 0 1 1
x 1 0 1
1 0 1 1
0 0 0 0 x
1 0 1 1 x x
1 1 0 1 1 1
(1011)2×(101) 2 = (110111)2
11) 1 0 1 0 1 (111
1 1
1 0 0
1 1
0 0 1 1
1 1
0 0
FUNCTION AREA(L,B)
AREA=L*B
END FUNCTION
SUB AREA(L,B)
P=2*(L+B)
PRINT “PERIMETER OF RECTANGLE=”; P
END SUB
(ख) “STUDENT.DAT”
file मा द्विद्यािीहरूको नाम, कक्षा, सेक्सन र ठे गाना भण्डारर् गररएको छ । द्विद्यािीहरूको नाम, कक्षा, सेक्स
न र ठे गाना द्वप्रन्ट गने प्रोग्राम लेख्नुहोस् ।
Students' name, class, section and address are stored in a data file called "STUDENT.DAT" Write a
program to print all the records of students.
१०. C ल्याङ् वेर्को प्रयोग गरे र प्रयोगकतााबाट कुनै िु ईिटा नम्बरहरु मागेर र सो नम्बहरुको
औषत द्वनकाल्ने प्रोग्राम लेख्नुहोस् । Write C program to find average number of any two numbers. (४)
#include <stdio.h>
int main()
{
int num1, num2;
float avg;
printf("Enter first number: ");
scanf("%d",&num1);
printf("Enter second number: ");
scanf("%d",&num2);
avg= (num1+num2)/2;
printf("Average of two number is: %f",avg);
return 0;
}
िा (OR)
C-language को प्रयोग गरी द्विइएको अनुक्रम िे खाउने (२, ४, ६, ८.१० औं पि) प्रोग्राम लेख्नुहोस् ।
Write a program in C-language to display the series 2, 4, 6, 8 up to the 10th term.
#include<stdio.h>
void main( )
{
int i,a=2;
for(i=1;i<=10;i++)
{
printf(“%d”, a);
a=a+2;
}
}
The END
b) Define software security. Write any two protection measures for it.
Ans: Software security means protecting software from being hacked or misused which ensures the
software works properly and keeps data safe.
Any two protection measures for software security are: Backup and Password
5. Write the output of the given program: (Workout with a dry run). 2
DECLARE SUB ABC(A)
CLS
A=2
CALL ABC(A)
END
SUB ABC(A)
FOR J= 1 TO 5
PRINT A;
A=A+3;
2|P a g e CS SEE 2078 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
NEXT J
END SUB
Dry run
A J=1 TO 5 PRINT A; A=A+3
2 1 to 5 Yes 2 2+3=5
5 2 to 5 Yes 5 5+3=8
8 3 to 5 Yes 8 8+3=11
11 4 to 5 Yes 11 11+3=14
14 5 to 5 Yes 14 14+3=17
17 6 to 5 No (loop
exits)
The output of the program is
2 5 8 11 14
Debugged Program
DECLARE SUB Series ( )
CLS
CALL Series
END
SUB Series( )
REM Program to generate 1 1 2 3 5 .....upto the 20th terms
A=1
B=1
FOR ctr=1 TO 10
PRINT A; B;
A=A+B
B=A+B
NEXT ctr
END SUB
7. Study the following program and answer the given questions. 2x1=2
DECLARE FUNCTION TEST(X)
X=100
Z=TEST(X)
PRINT Z
END
FUNCTION TEST(X)
FOR R=1 TO X
S=S+I
NEXT R
TEST=S
END FUNCTION
(11111101)2 = (FD)16
(245)10 = (11110101)2
Quotient = 111
Remainder = 100
4|P a g e CS SEE 2078 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
iii) (1010) 2 x (101) 2 =(?)2
1 0 1 0
x 1 0 1
1 0 1 0
0 0 0 0 x
1 0 1 0 x x
1 1 0 0 1 0
9 a) 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]]
FUNCTION AREA(L,B)
AREA = L*B
END FUNCTION
SUB PER(L,B)
P=2*(L+B)
PRINT “Perimeter of rectangle=”; P
END SUB
b) Write a program to create a sequential data file “salary.dat” to store programmer’s name, salary
and post according to the need of the user.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n>0)
printf("%d is positive number",n);
else if(n<0)
printf("%d is negative number",n);
else
printf("%d is zero number",n);
return 0;
}
OR
***
Ans: The field names are Symbol No., Name and Marks.
5. Write down the output of the given program. Show with dry run in table. 2
DECLARE SUB Result(C$)
C$=”COMPUTER”
CALL Result(C$)
END
SUB Result(C$)
FOR C=1 TO LEN(C$) STEP 2
M$=MID$(C$,C,1)
N$=N$+M$
NEXT C
PRINT N$
END SUB
Dry run
C$ C=1TO 8 M$= MID$(C$,C,1) N$ =N$+M$ PRINT
step 2 Yes N$
COMPUTER C C CMUE
3 to 8 Yes M CM
5 to 8 Yes U CMU
7 to 8 Yes E CMUE
9 to 8 No
Loop Exits
Debugged Program
REM to display records from existing file.
CLS
OPEN “emp.txt” FOR INPUT AS #1
WHILE NOT EOF(1)
INPUT #1, eN$, post$, salary
PRINT eN$, post$, salary
WEND
CLOSE #1
END
7. Study the following program and answer the given questions. 2x1=2
DECLARE FUNCTION Prod(A,B)
CLS
INPUT “Enter first number”; A
INPUT “Enter second number”; B
PRINT “The product of the two number=”; prod(A,B)
END
FUNCTION Prod(A,B)
P=A*B
Prod=P
END FUNCTION
i) (ABC)16 = (?)2
Soln:
Hexadecimal digit A B C
Binary Equivalent 1010 1011 1100
value
(ABC)16 = (101010111100)2
-11
100
- 11
11
-11
00
Quotient = 111
Remainder = 00
9 a) Write a program to calculate Area of circle using Function procedure and use SUB procedure
to calculate its circumference in Q-Basic. [Hint: [A=r2], [C=2r]
FUNCTION AREA(R)
AREA = 22/7*R^2
END FUNCTION
SUB CIR(R)
C=2*22/7*R
PRINT “Circumference of circle=”; C
END SUB
b) Students Name, Class, Section and Address are stored in a data file called “STUDENT.dat”.
Write a program to print all the records of students.
OPEN “student.dat” FOR INPUT AS #1
CLS
PRINT “Name”, “Class”, “Section”, “Address”
WHILE NOT EOF(1)
INPUT #1, N$, C, S$, A$
PRINT N$, C, S$, A$
WEND
CLOSE #1
END
10. Write a program in C language to input a number then check whether the number is fully
divisible by 5 or not.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n%5= =0)
printf("%d is fully divisible by 5",n);
else
printf("%d is not fully divisible by 5",n);
return 0;
}
OR
Write a program in C language to display the series 2, 4, 6, 8 up to 10th terms.
#include<stdio.h>
#include<conio.h>
int main()
{
int i, a;
i=1;
a=2;
while(i<=10)
{
printf("%d \n", a);
a=a+2;
i++;
}
return 0;
}
***
Group A
e) What is looping?
Ans: Looping is the process of repeating the execution of a statement or a block of statements until a
specific condition is satisfied.
Debugged Program
REM program to make a word reverse
DECLARE FUNCTION Rev$(N$)
CLS
INPUT “Enter a word”; N$
PRINT “Reversed is”; Rev$(N$)
END
FUNCTION Rev$(N$)
FOR K=LEN (N$) To 1 STEP-1
B$=B$+MID$(N$,K,1)
NEXT K
Rev$=B$
END FUNCTION
b) How many times does the WHILE ….WEND loop repeat if the value of N is 123?
Ans: The WHILE ….WEND loop repeats 3 times if the value of N is 123.
(10110011)2 = (CD)16
(524)10 = (1000001100)2
iii) (1010)2 (110)2 – (1011)2 = (?)2
1 0 1 0
× 1 1 0
0 0 0 0
1 0 1 0 ×
1 0 1 0 × ×
1 1 1 1 0 0
- 1 0 1 1
1 1 0 0 0 1
(1010)2 (110)2 – (1011)2 = (110001)2
4|P a g e CS SEE GP B 2078 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
iv) (10110)2 ÷ (101)2
101) 10110( 100
-101
00010
- 0
10
Quotient = 100
Remainder = 10
a) 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.
DECLARE SUB VOL(L,B,H)
DECLARE FUNCTION AREA(L,B,H)
CLS
INPUT “Enter length”; L
INPUT “Enter breadth”; B
INPUT ”Enter height”; H
CALL VOL(L, B, H)
PRINT “Area of four walls=”; AREA(L, B, H)
END
SUB VOL(L, B, H)
V=L*B*H
PRINT “Volume of room”; V
END SUB
FUNCTION AREA(L, B, H)
AREA=2*H*(L+B)
END FUNCTION
b) A sequential data file called “Record.dat” has stored data under the field heading Roll No.,
Name, Gender, English, Nepali, Maths and Computer. Write a program to display all the
information of those students whose marks in English is more than 40.
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b;
printf("Enter any two numbers:\n ");
scanf("%d %d", &a, &b);
if(a>b)
printf("The greatest number is %d", a);
else
printf("The greatest number is %d", b);
return 0;
}
OR
Write a program in C-Langauge to display the series with their sum. 1,2,3,4….upto 10th terms.
#include <stdio.h>
int main()
{
int j, sum = 0;
printf("The first 10 natural number is :\n");
for (j = 1; j <= 10; j++)
{
sum = sum + j;
printf("%d ",j);
}
printf("\nThe Sum is : %d\n", sum);
}
***
Form Report
Form is primarily used for entering data Report is used for presenting the data.
Form is designed to be used on screen. Report are designed to be printed.
Write the output of the given program showing the dry run table. (2)
R=A MOD B
IF R MOD 2=0 THEN
C=R MOD 6+30
ELSE
C=R MOD 6+15
ENDIF
D=C\5
OUT=D
END FUNCTION
REM To store name, age and salary in a sequential data file REC.DAT
CLS OPEN "Employee.dat" FOR OUTPUT AS #1
DO
INPUT "Enter employee's name"; N$
INPUT "Enter employee's address"; A$
INPUT "Enter employee's age"; Al
INPUT "Enter employee's gender";G$
INPUT "Enter employee's salary";S
WRITE #1,A$,AI,G$,S
INPUT "Add more records(Y/N)";A
LOOP WHILE UCASE(A$)="Y"
CLOSE 1
END
Debugged Program
REM To store name, age and salary in a sequential data file REC.DAT
CLS
OPEN "REC.DAT " FOR OUTPUT AS #1
DO
INPUT "Enter employee's name"; N$
INPUT "Enter employee's address"; A$
INPUT "Enter employee's age"; Al
INPUT "Enter employee's gender";G$
INPUT "Enter employee's salary";S
WRITE #1,A$,AI,G$,S
INPUT "Add more records(Y/N)";A$
LOOP WHILE UCASE$(A$)="Y"
CLOSE #1
END
7. Read the program given below and answer the questions that follows.(2)
SUB FACTORS(N)
FOR J=1 TO N
R=N MOD J
IF R=0 THEN PRINT J;
NEXT J
END SUB
Questions:
a) Write down the use of MOD in the program.
The use of MOD is to return remainder in the program.
1 1 1 0 1 1
+ 1 1 0 1 1
1 0 1 0 1 1 0
- 1 0 0 1 1
1 0 0 0 0 1 1
1 0 0 1 1
× 1 0 1
1 0 0 1 1
0 0 0 0 0 ×
1 0 0 1 1 × ×
1 0 1 1 1 1 1
111) 1 0 1 1 1 1 1 (1101
1 1 1
1 0 0 1
1 1 1
0 0 1 0 1 1
1 1 1
0 0 0 1 0 0
Q = 1101
R = 100
iii. (458)10 into octal
Soln:
(458)10 = (712)8
9 a. Write a program in QBASIC that allow user to enter radius of a circle. Create user define
FUNCTION...END FUNCTION to find area of circle and SUB...END SUB to find volume of a cylinder.
FUNCTION AREA(R)
AREA = 22/7 * R ^2
END FUNCTION
SUB VOL(R,H)
V = 22/7 * R ^ 2 * H
PRINT “Volume of cylinder=”; V
END SUB
b. Write a program to open data file new.dat which may contain name, address, phone no. and salary. The
program should allow user to add few records on it. (4)
10. Write a program in 'C' language to check whether the supplied number is divisible by 5 or not. (4)
#include <stdio.h>
int main( )
{
int n;
printf("Enter a number: ");
scanf("%d", &n);
if (n % 5 == 0)
{
printf("The number is divisible by 5.");
}
else
{
printf("The number is not divisible by 5.");
}
return 0;
}
OR
Write a program in 'C' language to find sum of first ten natural numbers.
#include <stdio.h>
int main()
{
int i, s = 0;
THE END
SOLEVD NATIONAL PABSAN KATHMANDU
Pre-Qualifying Exam-2081
Class-X
FM-50
Sub-Opt, Computer Science
Time-2hrs
PM-17.5
a. Networking devices use to regenerate the signal and transfer further. Repeater
b. Online postal service, E-mail
a. What are the two advantages of ring topology over bus topology?
Ans: The two advantages of ring topology over bus topology are:
Ring topology manages data traffic more efficiently with technologies like token passing.
Ring topology supports equal data transmission opportunities for all devices.
b. Define hardware security. Write the importance of power protection device to protect the
computer.
Ans: Hardware security refers to the protection of the physical components of a computer or electronic
device from unauthorized access, theft, or damage.
The importance of power protection device to protect the computer is to prevent damage to the computer's
hardware and data loss due to sudden power fluctuations.
g. Write down the advantages of database management system over traditional data storage system.
The advantages of database management system over traditional data storage system are:
a) It reduces data redundancy which means duplication of data.
b) It allows multiple users to access the same data simultaneously.
c) Large volume of data can be stored and updated easily.
d) It provides high security of data as well as maintains accurate database.
h. What is the difference of 'Allow Zero length' and 'required' field properties of MS-Access.
Ans: The "Allow Zero Length" property controls if empty strings are allowed, while the "Required"
property ensures the field cannot be left null.
SUB series ()
i=3
FOR c = 1T0 5
PRINT i *c^2;
NEXT c
END SUB
Dry Run
i C=1 to 5 PRINT i *c^2;
3 1 to 5 yes 3x1^2
3x1
=3
2 to 5 yes 3x2^2
3x4
=12
3 to 5 yes 3x3^2
=3x9
27
4 to 5 yes 3x4^2
=3x16
=48
5 to 5 yes 3x5^2
3x25
=75
6 to 5 no
Loop exists
6. Re-write the given program after correcting the bugs. REM to find the factorial of a given number.
[2]
FUNCTION FACTO ( )
F=1
WHILE N = 0
F =F* N
N=N-1
WEND
FACTO=F
END SUB
Debugged Program:
DECLARE FUNCTION FACTO (N)
CLS
INPUT "Enter a number"; N
PRINT FACTO (N)
END
Questions:
a) How many parameter(s) is used in the above program? List them.
Ans: 1 parameter is used in the above program.
(9876)10 = (10011010010100)2
ii. (2081)16 into octal
Converting hex to binary
6C16 =
6 = 0110
C = 1100 = 11011002
11011002
Converting binary to octal
001 = 1
101 = 5
100 = 4
(2081)16 = (154)8
iii. 11010+10110
1 1 0 1 0
+ 1 0 1 1 0
1 1 0 0 0 0
11010+10110 = 110000
101) 1 0 1 1 1 0 (1001
-1 0 1
0 0 0 1 1 0
1 0 1
0 0 1
Q = 1001
R=1
9. (a) Write a program to calculate area of a circle using SUB..... END SUB and perimeter of rectangle
using FUNCTION... END FUNCTION. [4]
SUB AREA(R)
A= 22/7 * R ^ 2
PRINT “Area of rectangle=”; A
END SUB
FUNCTION PERI(L, B)
PERI = 2 * (L + B)
END FUNCTION
b. A sequential file "detail.dat" contain Name, Age and mobile number of few persons. Write a
QBASIC program to display the name of those persons who are eligible to cast the vote. [ Age must be
18 or above to cast the vote.] [4]
10. Write a C program to test whether the given number is exactly divisible by 13 or not.
#include <stdio.h>
int main()
{
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 13 == 0)
{
printf("The number %d is divisible by 13.\n", num);
}
else
{
printf("The number %d is not divisible by 13.\n", num);
}
return 0;
}
***
PABSON, Lalitpur
SEE PRE-QUALIFYING EXAMINATION-2081
Subject-Opt II. Computer Science
Time: 3 hrs
Attempt all questions.
Group A [20 Marks]
a) What is hacking?
Hacking is the act of breaking into computer systems or networks without permission, often to steal,
change, or destroy data, or to disrupt operations.
a) What do you mean by digital footprint? List any two ways to maintain our digital reputation.
A digital footprint is the trail of data and information left behind by an individual's online activities
which includes social media posts, website visits, online purchases, and other digital engagements.
Any two ways to maintain our digital reputation are:
• Think carefully before sharing online, as it can be difficult to remove or change once it's posted.
• Use privacy settings to choose who can see your posts and keep your personal info, like your
phone number and address, private.
d) What do you mean a by field property in MS Access? List any two field properties with example.
Field properties are settings or attributes that allow users to control various aspects of data entry,
validation, formatting, and behavior within the database.
Any two field properties with example are:
• Field Size - Field size is a field property which is used to set the maximum size for data stored in
the field that is set to the Text or Number data type.
• Caption - Caption is a field property which gives alternative name given for any field.
The maximum size for this is 2048 characters.
f) What is hardware security? List any four methods to protect the data from your computer.
Hardware security refers to the protection of the physical components of a computer or electronic
device from unauthorized access, theft, or damage.
Any four methods to protect the data from computer are:
Password, Backup, Scandisk and Antivirus
g) What is bus topology? Mention any two differences between bus and ring topology.
Bus topology is a network configuration where all devices are connected to a single central cable
known as a "bus".
Any two differences between bus and ring topology
Bus Topology Ring Topology
Data sent in both directions over a shared cable Data sent in one direction around the ring
Failure in the bus can disrupt the entire network Single point of failure can disrupt the network, but
can be mitigated with dual rings
Write the output of the given program showing the dry run table. (2)
DECLARE SUB test()
CALL test
END
SUB test
X=0
FOR K=10 TO 4 STEP-2
A=K^2
X=X+A
NEXT K
PRINT X
END SUB
Debugged Program
REM To copy all data from sequential data file INFO.DAT to NEWINFO.DAT.
OPEN "INFO.DAT" FOR INPUT AS #1
OPEN "NEWINFO.DAT" FOR OUTPUT AS #2
DO WHILE NOT EOF(1)
LINE INPUT #1, ALL$
WRITE #2, ALL$
LOOP
CLOSE #1,#2
END
7. Read the program given below and answer the questions that follows.(2)
DECLARE FUNCTION RETURNS(A$)
LINE INPUT "Enter a Sentence"; S$
PRINT RETURN$(S$)
END
FUNCTION RETURNS(A$)
FOR T=1 TO LEN(A$)
E$= MID$(A$,T,1)
IF E$ SPACE$(1) THEN
R$=E$+R$
END IF
NEXT T
RETURN$=R$
END FUNCTION
Questions:
a) List all the string library function(s) from the program.
The string library function(s) from the program are: LEN( ), MID$( ), SPACE$( )
b) How many times loop T execute, if A$= 'MY PRIDE MY NATION"?
T execute 18 times, if A$= 'MY PRIDE MY NATION"?
iii. (10101)2-(11011)2+(10001)2
iy (101101)2 (100)
100) 1 0 1 1 0 1 (1011
1 0 0
1 1 0
1 0 0
1 0 1
1 0 0
1
Q=1011
R=1
Write a program in QBASIC that asks length, breadth and height of room and calculates its area and volume.
Create a user-defined function to calculate area and sub-program to calculate volume. (4) [Hint: Area=LxB
Volume LXBXH]
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
19. A sequential data file called "STUDENT.DAT" has stored data under the field heading Registration No.,
Class, Section, Name, Date of Birth and Gender. Write a program to display all the information of class
NINE students whose gender is 'FEMALE'. (4)
11. Using C language, write a program to input three integers then display the highest integer. (4)
#include <stdio.h>
int main()
{
int num1, num2, num3;
printf("Enter three integers: ");
scanf("%d %d %d", &num1, &num2, &num3);
if (num1 >= num2 && num1 >= num3)
{
printf("The highest integer is: %d\n", num1);
}
else if (num2 >= num1 && num2 >= num3)
{
printf("The highest integer is: %d\n", num2);
} else
{
printf("The highest integer is: %d\n", num3);
}
return 0;
}
OR
Using C language, write a program to display all even numbers from 20 to 40 along with their sum.
#include <stdio.h>
int main()
{
int sum = 0;
printf("Even numbers from 20 to 40 are:\n");
for (int i = 20; i <= 40; i++) {
if (i % 2 == 0)
{
printf("%d ", i);
sum += i;
}
}
printf("\nSum of even numbers from 20 to 40 is: %d\n", sum);
return 0;
}
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
2081-06-18
SOLVED
PABSON Kathmandu
MID TERMINAL EXAMINATION-2081 [SET A]
Subject: Opt. II Computer Science Full Marks: 50
Class: 10 Time: 2 hrs.
Candidates are required to answer the questions in their own way words as far as practicable. Figures
in the margin indicate the full marks.
a) What is LAN?
Ans: LAN (Local Area Network) is a network that connects computers within a limited area such as a home,
school, or office building.
f) What is looping?
Ans: Looping is the process of repeating a set of instructions until a specified condition is met.
c) What do you mean by software security? Write any two methods to protect the computer software.
Ans: Software security refers to measures taken to protect software from unauthorized access,
vulnerabilities, and malicious attacks.
Two methods to protect computer software:
• Use strong passwords.
• Install and regularly update antivirus software.
5. Write down the output of the given program. (Show with dry run in table). (2)
SUB Show(XY$)
A = 47
FOR I = 1 TO 5
N = A MOD 7
PRINT MID$(XY$, N, 1)
A=A-1
NEXT I
END SUB
7. Study the following program and answer the given questions: (2x1=2)
End
Questions:
i) (231)8 = (x)10
(2 × 8²) + (3 × 8¹) + (1 × 8⁰)
(2 × 64) + (3 × 8) + (1 × 1)
(128) + (24) + (1)
= 153
(231)8 = (153)10
(1D3)16 = (111010011)2
ⅲ) (111001-11) + 111001
1 1 1 0 0 1
- 1 1-
1 1 0 1 1 0
+ 1 1 1 0 0 1
1 1 0 1 1 1 1
Q=111
R=11
a) WAP that asks principal, time and rate of interest and calculate simple interest using SUB.... END
SUB and amount using FUNCTION.... END FUNCTION. [Hint: SI=P*T*R/100, Amount=P+SI]
b Write a program to check whether a string is palindrome or not using SUB...END SUB
10. Write a program to ask number and check it is exactly divisible by 4 and 6 using SUB......END
SUB.
DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END
or
Write a program in QBASIC to display sum of first 10 natural numbers using FUNCTION.... END
FUNCTION.
FUNCTION SUM( )
S=0
FOR I = 1 TO 10
S=S+I
NEXT I
SUM = S
END FUNCTION
Candidates are required to answer the questions in their own way words as far as practicable. Figures
in the margin indicate the full marks.
f) What is data types? List any four important data types used in MS-Access.
Ans: Data type is an attribute for a field that determines the type of data that can be stored in that field.
Any four important data types used in MS-Access are : text, memo, number and currency.
5. Write down the output of the given program. (Show with dry run in table). (2)
7. Study the following program and answer the given questions: (2x1=2)
Questions:
a) Write the name of two built in functions used in the above program.
Ans: The two built in functions used in the above program Re LEN ( ), RIGHT$( )
b) List the real parameters of the above program.
Ans: W$ is the real parameter used in the above program.
i) (231)10 = (x)16
Divide by the base 16 to get the digits from the remainders:
Division Quotient Remainder
by 16 (Digit)
(231)/16 14 7
(14)/16 0 14
4|P a g e CS SEE JEC BKT 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
= (E7)16
(231)8 = (153)10
ⅲ) (1101001-1111) + 111001
1 1 0 1 0 0 1
1 1 1 1
1 0 1 1 0 1 0
+ 1 1 1 0 0 1
1 0 0 1 0 0 1 1
Q=1100
R=101
a) WAP to calculate area of rectangle using FUNCTION and area of circle using SUB.
10. Write a program to ask a number and check it is exactly divisible by 3 and 7 using
FUNCTION……END FUNCTION.
DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END
or
Write a program to accept age and citizen of a person to check whether he/she is eligible to cast vote or not using
SUB…END SUB.
SUB CHECK(A)
IF A >=18 THEN
PRINT “You are eligible to vote”
ELSE
PRINT “You are not eligible to vote”
END IF
5. Write down the output of the given program with a dry run table:
DECLARE SUB PATTERN(N)
CALL PATTERN
END
SUB PATTERN
A=2
FOR I=1 TO 5
PRINT A;
A=A+2
NEXT I
END SUB
FUNCTION SUM(M, N)
REM to print sum of two numbers
A=6
B=7
DISPLAY sum(M,N)
END
FUNCTION SUM(M,N)
1|P a g e CS PABSON SET A 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
S=M+N
S=SUM
END FUNCTION
FUNCTION ODDEVEN$(N)
IF N MOD 2=0 THEN
MS$="even"
ELSE
MS$="odd"
END IF
ODDEVEN$=MS$
END FUNCTION
Questions:
8. Conversion/Calculation:
9a. Write a program in QBASIC to display the greater number using a function procedure and the smaller
number using a sub procedure among three numbers.
b. Create a sequential data file to store the name and marks obtained in English, Math, and Science subjects
for a few students.
f) Define IP address.
Ans: IP address is a unique numerical identifier for every device or network that connects to the
internet.
Group "B"
4. Answer the following questions in short : [9x2=18]
a) What is network topology? List them.
Ans: Network topology refers to the physical or logical arrangement of network components.
Its types are: bus topology, ring topology and star topology
FUNCTION SUM(M, N)
REM to print sum of two numbers
A=6
B=7
DISPLAY sum(M,N)
END
FUNCTION SUM(M,N)
S=M+N
S=SUM
END FUNCTION
Debugged Program
DECLARE FUNCTION SUM(M, N)
REM to print sum of two numbers
A=6
B=7
PRINT sum(A,B)
END
FUNCTION SUM(M,N)
S=M+N
SUM=S
END FUNCTION
7. Study the following programs and answer the given questions. [2x1=2]
DECLARE FUNCTION ODDEVEN$(N)
CLS
INPUT ”Enter a number”; N
PRINT “Number is”; ODDEVEN$(N)
END
FUNCTION ODDEVEN$(N)
IF N MOD 2=0 THEN
MS$=”even”
ELSE
MS$=”odd”
END IF
ODDEVEN$=MS$
END FUNCTION
a) What is the main objective of above program?
Ans: The main objective of the above program is to check whether the input number is even or odd.
b) What is the use of MOD in above program?.
Ans: The MOD operator (modulus) is used to find the remainder of a division between two numbers.
b) (111)10 = (?) 2
2 111 Remainder
2 55 1
2 27 1
2 13 1
2 6 1
2 3 0
2 1 1
2 0 1
(111)10 = (1101111) 2
1 0 0 0
- 1 1 1
0 0 0 1
(1000) 2 – (111) 2 = (0001) 2
d) (111111) 2 ÷ (111) 2
Quotient = 1001
Remainder = 0
FUNCTION GREAT(A,B,C)
IF A>B AND A>C THEN
GREAT=A
ELSEIF B>A AND B>C THEN
GREAT=B
ELSE
GREAT=C
END IF
END FUNCTION
SUB SMALL(A,B,C)
IF A<B AND A<C THEN
PRINT"THE SMALLEST NUMBER IS ";A
ELSEIF B<A AND B<C THEN
PRINT"THE SMALLEST NUMBER IS ";B
ELSE
PRINT"THE SMALLEST NUMBER IS ";C
END IF
END SUB
b. Create a sequential data file to store name and mark obtained in English, Math and Science
subjects for few students.
OPEN “std.dat” FOR OUTPUT AS #1
DO
CLS
INPUT “Enter name”; N$
INPUT “Enter marks in English”; E
INPUT “Enter marks in math”; M
INPUT “Enter marks in science”; S
WRITE #1, N$, E, M, S
INPUT “Do you want to continue(Y/N)”; CH$
LOOP WHILE UCASE$(CH$)=”Y”
CLOSE #1
END
Group "B"
Answer the following questions in short:
a) What is the difference between a switch and a router?
b) Define two major uses of the internet.
c) What is data sorting? Give any two examples.
d) Define online payment with an example.
e) What is hardware security? Write any two security measures of it.
f) What is a report? Mention its uses.
g) What do you understand by data redundancy?
h) What is a firewall in a computer? Write its types.
i) What is a primary key? Write its importance.
Write down the output of the given program with a dry run table:
qbasic
Copy code
DECLARE SUB NUMBER ()
CLS
CALL NUMBER
END
SUB NUMBER
N=3:C=1
WHILE C<=5
PRINT N
N=N*10+3
C=C+1
WEND
END SUB
Re-write the given program after correcting the bug:
SUB question(a,b,c)
a = a +10
b=b+a
c=a+b
PRINT a,b,c
END SUB
a) What would be its output if x=1, y=2, z=3?
b) Write actual and formal parameters used in the program.
Conversion/Calculation:
a) Convert (1110011010)₂ to octal.
b) Convert (255)₁₀ to binary.
c) (1001)₂ – (111)₂ = (?)₂
d) (111111)₂ ÷ (111)₂
a) Write a program in QBASIC to display the greater number using a function procedure and the smaller
number using a sub procedure among three numbers.
b) A sequential data file called "record.txt" has stored data under the field heading Roll No., Name, Gender,
English, Nepali, Maths, and Computer. Write a program to display all the information of those students whose
gender is 'F' and obtained marks in computer is more than 90.
c) Define MS Access.
Ans: MS Access is a relational database management system developed by Microsoft which allows
users to store, manage, and analyze large volumes of data in a structured format using tables.
Group "B"
4. Answer the following questions in short : [9x2=18]
a) What is the difference between Switch and Router?
Router Switch
The main objective of router is to The main objective of switch is to
connect various networks connect various devices
simultaneously. simultaneously.
A router can take a routing decision The switch takes more time while
much faster than a switch. making complicated routing
decisions.
5. Write down the output of the given program with dry run table. [2]
DECLARE SUB NUMBER ()
CLS
CALL NUMBER
END
SUB NUMBER
N=3:C=1
WHILE C<=5
PRINT N
Output
3
33
333
3333
33333
Debugged Program
REM To store name and age in a sequential data file STD.DOC
OPEN “STD.DOC” FOR OUTPUT AS#1
CLS
INPUT”Enter name”;N$
INPUT”Enter age”;A
WRITE #1,N$,A
CLOSE #1
END
7. Study the following programs and answer the given questions. [2x1=2]
DECLARE SUB question (a, b, c)
CLS
x=10: y=20 : z=15
CALL question(x,y,z)
END
SUB question(a,b,c)
a = a +10
b=b+a
c=a+b
Convert every 3 binary digits (from bit0) to octal digit (see conversion table below):
1110011010
= 1 110 011 010
001= 1
110=6
011=3
010=2
= 1632
(1110011010)2 = (1632)8
b) (255)10 = (?) 2
d) (111111) 2 ÷ (111) 2
111) 1 1 1 1 1 1 (1001
1 1 1
0 0 0 1 1 1
1 1 1
0 0 0
Q=1001 R=0
FUNCTION GREAT(A,B,C)
IF A>B AND A>C THEN
GREAT=A
ELSEIF B>A AND B>C THEN
GREAT=B
ELSE
GREAT=C
END IF
END FUNCTION
SUB SMALL(A,B,C)
IF A<B AND A<C THEN
PRINT"THE SMALLEST NUMBER IS ";A
ELSEIF B<A AND B<C THEN
PRINT"THE SMALLEST NUMBER IS ";B
ELSE
PRINT"THE SMALLEST NUMBER IS ";C
END IF
END SUB
b. A sequential data file called "record.txt " has stored data under the field heading Roll No.,
Name, Gender, English, Nepali ,Maths and Computer. Write a program to display all the
information of those students whose gender is 'F' and obtained marks in computer is more
than 90.
OPEN ”record.txt” FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
INPUT #1,R,N$,G$,E,N,M,C
IF UCASE$(G$)=”F” AND C>90 THEN
PRINT R,N$,G$,E,N,M,C
END IF
WEND
CLOSE #1
END
Group A
1. Answer the following questions in one sentence.
a) Where does intranet has been used?
b) Write any two benefits of cloud computing.
c) Which data type is used to store date of birth of an employee in MS-Access?
d) Write any two data type used in MS-Access database?
e) What are procedure in QBASIC?
f) Write any two features in 'C' language.
2. Write appropriate technical term for the following.
a) The protocol that makes the network communication possible.
b) Digital marks created while using Internet.
3. Write the full form of the following.
a) ISDN
b) TCP/IP
Group B
4. Answer the following question in short.
a) Differentiate between peer to peer and client-server network with figure.
b) What is cyber ethics? Give any two example of it.
c) What is software security? Write any two measures of software security.
d) Define E-Commerce ? Write its importance.
e) Why mobile computing is necessary in present time? Write any two importance of it.
f) Differentiate between Primary key and Foreign key with example.
g) What is query? List any two advantages of it.
h) What is data sorting ? List any two advantages of using it.
i) Define form. Write its importance.
Group C
5. Write down the output of the given program. Show with dry run in table.
SUB SERIES ( )
X=1
Y=2
FOR P =1 TO 10
PRINT X;
X=X+Y
Y=Y+1
NEXT P
END SUB
FUNCTION text$(N$)
FOR i=len (N$) TO 1 STEP-1
W$=W$+MID$(N$,i,1)
NEXT i
text$ = WS
NEXT Q
END FUNCTION
Group A
1. Answer the following questions in one sentence.
Group B
(c) What is software security? Write any two measures of software security.
Ans: Software security is the protection of computer systems and applications from threats, such as hacking,
virus attacks, and unauthorized access, to ensure their confidentiality, integrity, and availability.
Any two measures of software security are:
backup
3|P a g e CS PABSON SET C 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
password
e) Why mobile computing is necessary in present time? Write any two importance of it.
Ans: Mobile computing allows users to access information and perform tasks from mobile devices.
Any two importance of mobile computing are:
It allows people to work and communicate from anywhere at any time.
It keeps connected to the Internet, allowing to access information all the times.
5. Write down the output of the given program. Show with dry run in table.
SUB SERIES ( )
X=1
Y=2
FOR P =1 TO 10
PRINT X;
X=X+Y
Y=Y+1
NEXT P
END SUB
Dry run
X Y P=1 TO 10 PRINT X; X=X+Y Y=Y+1
1 2 1 TO 10 Yes 1 1+2=3 2+1=3
3 3 2 TO 10 Yes 3 3+3=6 3+1=4
6 4 3 TO 10 Yes 6 6+4=10 4+1=5
10 5 4 TO 10 Yes 10 10+5=15 5+1=6
15 6 5 TO 10 Yes 15 15+6=21 6+1=7
21 7 6 TO 10 Yes 21 21+7=28 7+1=8
28 8 7 TO 10 Yes 28 28+8=36 8+1=9
36 9 8 TO 10 Yes 36 36+9=45 9+1=10
45 10 9 TO 10 Yes 45 45+10=55 10+1=11
55 11 10 TO 10 55 55+10=65 11+1=12
Yes
66 12 11 TO 10 No
Loop Exits
Debugged Program
CLS
OPEN "employee.dat" FOR OUTPUT AS #1
5|P a g e CS PABSON SET C 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
DO
INPUT "Enter Name, address and gender": NS, A$, G$
WRITE #1, NS, A$, G$
INPUT "Do you want to continue "; Y$
LOOP WHILE UCASE$(Y$) = "Y"
CLOSE #1
END
7. Study the following program and answer the given questions: [2]
DECLARE FUNCTION text$(N$)
CLS
INPUT "Enter any string":X$
PRINT text$(X$)
END
FUNCTION text$(N$)
FOR i=len (N$) TO 1 STEP-1
W$=W$+MID$(N$,i,1)
NEXT i
text$ = WS
NEXT Q
END FUNCTION
Questions:
Group C
c) ( 10101) 2 X (111)
1 0 1 0 1
x 1 1 1
1 0 1 0 1
1 0 1 0 1 x
1 0 1 0 1 x x
10 0 1 0 0 1 1
(10101)2×(111) 2 = (10010011)2
b) (645) 10 = (?)16
6|P a g e CS PABSON SET C 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
16 645 Remainder
16 40 5
16 2 8
0 2
(645) 10 = (285)16
d) (111110) / (110)
Quotient = 1010
Remainder = 10
9. a) Write a program in QBASIC to input length and breadth of room and calculate its area using
function and perimeter using sub procedure. [Hint: Area = lxb.
Perimeter = 2(l+b)]
FUNCTION AREA(L,B)
AREA=L*B
END FUNCTION
SUB PERI(L,B)
P=2*(L+B)
PRINT “PERIMETER OF RECTANGLE=”; P
END SUB
b) A sequential data file called "Records.dat" has stored data under the field heading Roll No., Name,
Gender, English, Nepali, Maths and Computer. Write a program to display all the records of students
whose marks in computer is more than 90.
#include <stdio.h>
int main()
{
int i, s=0;
for(i=81; i<=90; i=i+2)
s=s+i;
printf("Sum of odd numbers from 80 to 90= %d", s);
return 0;
}
OR
Write a program in 'C' language to input three number and find greatest number among three
numbers.
#include <stdio.h>
int main()
{
int a, b, c;
printf("Enter any three numbers");
scanf("%d %d %d", &a, &b, &c);
if (a > b && a > c)
printf("%d is the largest number.", a);
else if (b > a && b > c)
printf("%d is the largest number.", b);
else
printf("%d is the largest number.",c);
return 0;
}
***
a) WLAN –
b) POP –
C. Write down the output of the given program. Show with dry run in table
SUB SERI
X# = 1
FOR I = 1 TO 5
PRINT X# * X#
X# = X# * 10 +1
NEXT I
END SUB
D. Rewrite the given program after correcting the bugs.
9 a.Write a program in QBasic that asks for the radius and height of a cylinder and calculates the volume
and curve surface area.
b. Write a program to display the records of those employees whose salary is more than Rs. 25,000.
10. Write a program in C language to ask to enter two numbers and find out the sum and product.
OR
Write a C program to ask to enter a number and then find out whether it is even or odd.
2. What is cyber-crime?
Ans. Cybercrime refers to illegal activities carried out using computers, networks, or the internet, such as
hacking, identity theft, online fraud, and spreading malicious software.
3. What is topology?
Ans. Network topology refers to the physical or logical arrangement of network components.
3.What is digital citizenship? List out the major themes of digital citizenship.
Ans. Digital citizenship refers to the responsible and ethical use of technology and the internet which
involves understanding, practicing, and promoting appropriate behavior when using digital tools and
resources.
Major themes of digital citizenship are :
Digital Access: The state of full electronic participation in society
Digital Commerce: The act of promoting the purchase of goods through electronic means
7.What is table in Access? In how many ways we can create a table in Ms Access?
Ans Tables are the primary building block of database which stores and manages large volume of data
into rows and column.
Ways to create a table in Ms Access are :
Design view
Datasheet view
Using wizard
SUB SERI
X# = 1
FOR I = 1 TO 5
PRINT X# * X#
X# = X# * 10 +1
NEXT I
END SUB
Dry Run Table
X# I=1 To 5 PRINT X# * X# X# = X# * 10 +1
1 1 to 5 ‘yes’ 1 11
11 2 to 5 ‘yes’ 121 111
111 3 to 5 ‘yes’ 12321 1111
1111 4 to 5 ‘yes’ 1234321 11111
11111 5 to 5 ‘yes’ 123454321 111111
111111 6 to 5 ‘no’
Loop exits
The output of the program is
1
121
12321
1234321
123454321
Debugged program
REM to create sequential data file "record.dat" to enter some records.
CLS
OPEN "record.dat" FOR OUTPUT AS #1
UP:
INPUT "ENTER NAME";N$
Questions:
a) How many parameters are used in the above program?
Ans. 1 parameter is used in the above program.
b) How many times does the statement S=S + I * I will be executed in the above program?
Ans. The statement S= S + I * I will be executed 10 times.
d)1110001 ÷ 110
Ans.
110) 1 1 1 0 0 0 1 (10010
1 1 0
0 0 1 0 0 0
1 1 0
0 0 1 0 1
0
1 0 1
Q=10010
R=101
9a. 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]
Ans.
DECLARE FUNCTION VOL(R,H)
DECLARE SUB CSA(R,H)
CLS
INPUT “ENTER THE RADIUS”;R
INPUT “ENTER THE HEIGHT”;H
PRINT “THE VOLUME OF CYLINDER IS ”;VOL(R,H)
CALL CSA(R,H)
END
FUNCTION VOL(R,H)
VOL = 3.14*R*R*H
END FUNCTION
SUB CSA(R,H)
C = 2*3.14*R*H
PRINT “THE CURVE SURFACE AREA OF CYLINDER IS ”; C
END SUB
b. A sequential data file called "Emp.dat" has stored data under the field heading name, post and
salary. Write a program to display the records of those employees whose salary is more than Rs.
25000.
Ans.
OPEN “Emp.dat” FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
INPUT #1,N$,P$,S
IF S > 25000 THEN PRINT N$,P$,S
WEND
CLOSE #1
END
10. Write a program in C language to ask to enter two numbers and find out sum and product.
Ans.
#include<stdio.h>
int main()
{
Int a,b,s,p;
printf(“enter first number “);
scanf(“%d”,&a);
printf(“enter second number ”);
scanf(“%d”, &b);
s = a + b;
p = a * b;
printf(“the sum of two numbers is %d”,s);
printf(“the product of two numbers is %d”,p);
return 0;
}
Write a C program to ask to enter a number then find out whether it is even or odd.
Ans.
#include<stdio.h>
Int main()
{
Int n;
printf(“enter any number”);
scanf(“%d”,&n);
if(n%2 = = 0)
printf(“The given number is even”);
else
printf(“The given number is odd”);
return 0;
}
(f) What is C?
C Language is a high-level structured programming language which is used to develop system software.
(b) What is digital footprint? Write any two tips to maintain digital reputation.
A digital footprint is the trail of data and information left behind by an individual's online activities which
includes social media posts, website visits, online purchases, and other digital engagements.
Any two tips to maintain digital reputation are:
1|P a g e CS PABSON BKT JEC 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Be Mindful of What You Share: Always think before posting anything online.
Regularly Review and Update Privacy Settings: Frequently check the privacy settings on your
social media accounts and other online platforms.
(c) What is password Policy? Write any two important criteria for creating strong password.
A password policy is a set of rules or guidelines designed to ensure that passwords are secure.
Any two important criteria for creating strong password are
Don't use easily guessable the name of a pet, child, family member, birthdays, birthplace, name of a
favourite holiday.
Mix characters, numbers and symbols. Also, mix small and capital letters.
a$="KATHMANDU”
b=LEN(a$)
FOR I=1 TO 5
PRINT TAB(I); MID$(a$, i, b)
b=b-2
NEXT I
END SUB
Debugged Program
Rem To print only class 10 record from "student.dat"
CLS
OPEN "T", #2, "Student.Dat"
WHILE NOT EOF (2)
INPUT#2, N$, C,R
(1) Read the following program and answer the questions given below.
DECLARE FUNCTION TEST (X)
CLS
Y = 100
Z = TEST (Y)
PRINT Z
END
FUNCTION TEST (A)
FOR I = 1 TO A
S=S+I
NEXT I
TEST = S
END FUNCTION
(a) List the different parameter used in the above program with their types.
Formal Parameters are A and X
Actual parameter is Y
(b) List the different operators used in the above program with their types.
Arithmetic operator is +
Relational operator is =
(c) 11110+10011
11110
+10011
0110001
11110 + 10011 = 0110001
(d) 1110110
6 . (a) Write a program in QBASIC that asks length,breadth and height of a room and calculates its
area and volume. Create a user-defined
function to calculate area and sub-program to calculate volume. [Hints: Area = LxB, Volume = L x B
x H)
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
(b) Write a program to update the rate by increasing 10% from a sequential data file "Data.dat" that
store item name, rate and quantity.
OPEN "DATA.DAT" FOR INPUT AS#1
OPEN "TEMP.DAT" FOR OUTPUT AS #2
CLS
WHILE NOT EOF (1)
INPUT #1, N$, R, Q
R1 = R + 10/100 * R
WRITE #2, N$, R1, Q
WEND
CLOSE #1, #2
KILL "DATA.DAT"
NAME "TEMP.DAT" AS "DATA.DAT"
END
Write a program in C language to ask to enter base and height of a triangle then calculate its area.
#include<stdio.h>
#include<conio.h>
int main()
{
5|P a g e CS PABSON BKT JEC 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
int b,h;
float a;
printf("Enter base: ");
scanf("%d", &b);
printf("Enter height: ");
scanf("%d", &h);
a=(b*h)/2;
printf("Area of triangle= %.2f", a);
return 0;
}
Or,
Group-B
(Short Questions - 24 Marks)
4) Answer the following questions:
a) Define data communication. Write its components.
b) Write any two Opportunities and Threats in Social Media.
c) What is software security? List any two security mechanisms of Computer Hardware Security.
d) Define M-commerce. Write any four examples of M-Commerce.
e) What do you mean by IoT? List its any two advantages.
f) What is DBMS? Write any two advantages of DBMS.
g) Define the term Validation Rule and Validation Text.
h) Differentiate between select query and update query.
i) Define Data types. List any four names of the data types.
Programming Questions
9. a) Write a QBASIC program that asks for the length, breadth, and height, and calculates the Volume of a
Cuboid and Total Surface Area. Create a USER-DEFINED FUNCTION to calculate the Volume of a
Cuboid and a SUB-PROGRAM to calculate the Total Surface Area.
b) A sequential data file "records.dat" contains S.NO., Name, Address, Telephone No, and Email Address.
Write a program to count and display those records whose email address ends in the "yahoo.com" domain.
Your display should be in tabular format, showing the fields Name, Address, and Email address only.
10. Write a program in C language that asks for a number and checks whether the number is Positive,
Negative, or Zero.
OR
Write a program in C language to display the series with their sum 7,10,13,16,…7, 10, 13,
16,\dots7,10,13,16,… up to the 10th term.
2|P a g e CS PABSON BKT JEC 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Group-A
(Very Short Questions-10 Marks)
1) Answer the following questions:
a) Define Bandwidth.
Ans: Bandwidth is the maximum amount of data that can be sent or received over a network in a specific
amount of time.
d) Define relationship.
Ans: A relationship is a connection between two or more tables that defines how data in those tables is
related to each other.
Group-B
(Short Questions-24 Marks)
4) Answer the following questions:
a) Define data communication. Write its components.
Ans: Data communication is the process of transferring data and information between computers and other
electronic devices.
Its components are:
Data (message) : Data is to be communicated between sender and receiver.
Sender : Sender is a device used to transfer data.
Medium: Medium is a channel through which sender and receiver make communication.
Receiver: Receiver is a device used to receive data.
Protocol: Protocol is a set of rules followed by sender and receiver.
c) What is software security? List any two security mechanism of Computer Hardware Security.
Software security is the protection of computer systems and applications from threats, such as hacking, virus
attacks, and unauthorized access, to ensure their confidentiality, integrity, and availability.
Any two security mechanism of Computer Hardware Security are:
i) Insurance
ii) Regular maintenance
DRY RUN
A$ B 1 TO 5 STEP 2 B< > 3 YES -PRINT No- PRINT B=B+1
MID$(A$,B,I) MID$(A$,1,I)
NEPAL 1 1 TO 5 YES 1 < > 3 YES N 1+1=2
2 3 TO 5 YES 2 < > 3 YES EPA 2+1=3
3 5 TO 5 YES 3 < > 3 NO NEPAL 3+1=4
4 7 TO 5 NO
LOOP EXITS
OUTPUT
N
EPA
NEPAL
Debug
Debugged Program
Analytical Questions
1 0 1 0 1 0
x 1 0 1 0 1 1
1 0 1 0 1 0
1 0 1 0 1 0 x
0 0 0 0 0 0 x x
1 0 1 0 1 0 x x x
0 0 0 0 0 0 x x x x
1 0 1 0 1 0 x x x x X
1 1 1 0 0 0 0 1 1 1 0
- 1 0 0 1 0 1
1 1 0 1 1 1 0 1 0 0 1
b) (1001011)2 ÷ (10101)2
10101) 1 0 0 1 0 1 1 (11
1 0 1 0 1
1 0 0 0 0 1
1 0 1 0 1
0 0 1 1 0 0
Q=11
R=1100
c) (DEF42)16 =(?)8
Convert each hex digit to 4 binary digits and then convert each 3 binary digits to octal digits (see conversion
tables below):
DEF42
=DEF42
D= 1101
E =1110
F=1111
4 =0100
2=0010
= 11 011 110 111 101 000 010
011=3
011 =3
110=6
111=7
101=5
000=0
010=2
=3367502
7|P a g e CS PABSON BKT JEC 2079 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
(DEF42)16 =(3367502)8
c) (986)10 = (?)2
(986)10 = (1111011010)2
9. a) 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.
DECLARE FUNCTION VOL(L,B,H)
DECLARE SUB TSA(L,B,H)
CLS
INPUT”Enter length”;L
INPUT”Enter breadth”;B
INPUT”Enter height”;H
PRINT”Volume of cuboid= “;VOL(L,B,H)
CALL TSA(L,B,H)
END
FUNCTION VOL(L,B,H)
VOL=L*B*H
END FUNCTION
SUB TSA(L,B,H)
T=2*(L*B+B*H+L*H)
PRINT”Total surface area of cuboid=”;T
END SUB
10. Write a program in C language that asks a number check whether number is Positive, Negative or
zero.
#include<stdio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d",&n);
if(n>0)
printf("The given number is positive");
else if(n<0)
printf("The given number is negative");
else
printf("The given number is zero");
return 0;
}
OR
Write a program in C language to display the series with their sum 7, 10, 13, 16…… upto 10th term.
#include<stdio.h>
int main()
{
int n=7,i,s=0;
for(i=1;i<=10;i++)
{
printf("%d ",n);
s=s+n;
n=n+3;
}
printf("\nsum= %d",s);
return 0;
}
(e) Which data type is used to store your school fee in MS-Access?
Currency is the data type used to store school fee in MS-Access.
(b) A concept of transferring data from your computer to server Computer. Uploading
Cyber crime refers to criminal activities that are carried out using computers, networks and the internet.
Phishing is the fake attempt to obtain sensitive information such as usernames, passwords and credit card
details by disguising oneself as a trustworthy entity in an electronic communication
FUNCTION ABC$(X$)
C=4
FOR i=1 to 1
BS=MID$(X$,4,3)
NEXT I
ABC$=B$
END FUNCTION
Dry Run
A$ C i=1 to BS=MID$(A$,4,3) ABC$=B$ PRINT
1 ABC$("COMPUTER")
COMPUTER 4 1 to 1 MID$(X$,4,3)= PUT PUT
yes PUT
2 to 1
No
Loop
Exits
The output of the program is:
PUT
SUB sbn()
INPUT "enter the variable value”; var
PRINT "Square of given number"; var^2
END
Debugged Program
SUB sbn( )
INPUT "enter the variable value”; var
PRINT "Square of given number"; var^2
END SUB
(b) Write the name of String variable used in file based on above program.
Te name of String variable used in file based on above program are :
Name$, Add$
Group C
2 2079 Remainder
2 1039 1
2 519 1
2 259 1
2 129 1
2 64 1
2 32 0
2 16 0
2 8 0
2 4 0
2 2 0
1 0
0 1
(2079)10 = (100000011111)2
(c) (11001110)+(110011)
11001110
+110011
100000001
(11001110)+(110011) = (100000001)
(d) (101001)(101)
9. Write a program to find area of four walls using FUNCTION... END perimeter of rectangle using
SUB...END SUB.
FUNCTION AREA(L,B)
AREA = 2*H*(L+B)
END FUNCTION
SUB PER(L,B)
P=2*(L+B)
PRINT “Perimeter of rectangle=”; P
END SUB
11. Write a program to read a number and test whether it is positive and negative using C-
programming.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n>0)
printf("%d is positive number",n);
else if(n<0)
printf("%d is negative number",n);
return 0;
}
b) What to loT?
Ans: IoT (Internet of Things) refers to the network of interconnected devices that communicate and
exchange data via the internet.
e) What is tuple?
Ans: A tuple is a row in a table which contains information about single items in a database.
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)
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.
FUNCTION PRE(A)
WHILE A < >0
R = A MOD 10
S=S+R
A=A\10
WEND
PRE=S
END FUNCTION
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:
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=3r2, V=2/3r3)
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;
}
e) What is field?
Ans: A field is a column in a table which contains information about a certain type for all records.
f) What is C language?
Ans: C Language is a high-level structured programming language which is used to develop system
software.
Group 'B'
4. Answer the following questions:
a) What is transmission media? Write its types.
Ans: A channel or path through which data and information are transmitted between connected
devices in a network environment is called transmission media.
Its types are:
1. Guided (Wired/bounded) communication media (Fiber optic, Twisted Pair and Co-axial)
2. Unguided (Wireless/unbounded) communication media (Radiowave, Microwave, Satellite)
e) What is information security? Write any two ways to protect our data.
Ans: Information security is the practice of protecting digital information from unauthorized access, corruption,
or theft. Two ways to protect data are:
• Using strong passwords and changing them regularly.
• Implementing encryption to secure sensitive data.
5. Write down the output of the given program. Show with dry run in table.
SUB SERIES
A=1
B=5
PRINT A
UP
INPUT "ENTER NAME:”; N$
INPUT "ENTER DEPARTMENT” ; D$
INPUT "ENTER POST”; P$
INPUT "ENTER SALARY”; SL
WRITE #2, N$, D$, P$, SL
INPUT "DO YOU WANT TO ADD MORE RECORD?(Y/N)”; AN$
IF UCASE$(ANS$)= "Y" THEN GOTO UP
CLOSE
END
Debugged Program
Questions:
a) What is the name of the function procedure? – TEST$( )
b) List the different library functions used in the program. – MID$( ), UCASE$( ), LCASE$( ), MID$( )
Group 'C"
8. Convert/calculate as per the instruction:
(511)10 = (111111111)2
Convert every octal digit to 3 binary digits, then convert every 4 binary digits to1 hex digit (see conversion
tables):
756
7 = 111
5 = 101
6 = 110
= 111 101 110
Convert binary to hexadecimal
= 1 1110 1110
1=1
1110=E
1110=E
(756)8 =(1EE)16
c. 1001 × 101 – 11
1 0 0 1
x 1 0 1
1 0 0 1
0 0 0 0 x
1 0 0 1 x X
1 0 1 1 0 1
- 1 1
1 0 1 0 1 0
d. 1001001 11001
11001) 1 0 0 1 0 0 1 (10
- 1 1 0 0 1
1 0 1 1 1
- 0
1 0 1 1 1
9. a. Write a program in ghasic that ask the radius and height of a cylinder then calculate its volume and
Total surface area. Create a user-defined function VLM(r, h) to calculate volume and sub procedure TOTSA
(r, h) to calculate total surface area of a a hemisphere [Hints: TSA=2r(r+h), V=r2h.
FUNCTION VLM(r, h)
VLM = 3.1416 * r * r * h
END FUNCTION
SUB TOTSA(r, h)
tsa = 2 * 3.1416 * r * (r + h)
PRINT "Total Surface Area of the cylinder: "; tsa
END SUB
b. A sequential data file called "marks.dat" has stored data under the field heading student's name. Eng, Nep
and Math. Write a program to display all the record whose marks is greater than 35 in all subjects.
10. Write a program in C language to ask to enter a number then find out whether it is odd or even number
#include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 2 == 0) {
printf("%d is even.\n", num);
6|P a g e CS SEE MADHESH 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
} else {
printf("%d is odd.\n", num);
}
return 0;
}
OR
#include <stdio.h>
int main() {
int sum = 0;
for (int i = 1; i <= 20; i++) {
sum += 2 * i;
}
printf("Sum of the first 20 even numbers: %d\n", sum);
return 0;
}
c) Which data types are used to store graphics and numeric characters in MS-Access?
Ans: OLE Object is used for graphics, and Number is used for numeric characters in MS-Access.
h) What is data type? List any two data types of MS- Access.
Ans: Data type is an attribute for a field that determines the type of data that can be stored in that
field. Two data types in MS-Access are Text and Date/Time.
5. Write down the output of the given program. Show with dry run in table.
DECLARE SUB show ( )
CLS
CALL show
END
SUB show
FOR I = 1 TO 7 STEP 3
S=S+I^3
NEXT I
PRINT S
END SUB
Dry Run
Debugged Program
b.(248)10 = (?)2
Divide by the base 2 to get the digits from the remainders:
Division Quotient Remainder Bit #
by 2 (Digit)
(248)/2 124 0 0
(124)/2 62 0 1
(62)/2 31 0 2
(31)/2 15 1 3
(15)/2 7 1 4
(7)/2 3 1 5
(3)/2 1 1 6
(1)/2 0 1 7
= (11111000)2
(248)10 = (11111000)2
1 1 0 1
x 1 1 0
0 0 0 0
1 1 0 1 x
1 1 0 1 x x
1 0 0 1 1 1 0
- 1 0 1 1
1 0 0 0 0 1 1
d. (1011101)2 (101)2
101) 1 0 1 1 1 0 1 (10010
- 1 0 1
0 0 0 1 1 0
- 1 0 1
0 0 1 1
0
1 1
4|P a g e CS SEE BAGMATI 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
Q=10010
R=11
9. a. WAP in QBASIC to print circumference of a circle using SUB and volume of a cylinder using
b. A sequential data file “Employee.dat” has some records with field's serial number, name. Address,
post and salary for the number of employees. Write a program to display all the records of those
emplovee's whose salary is more than Rs. 50000. [4]
10. Write a program to read any three integer numbers from the keyboard and find the smallest
number using C language. [4]
#include <stdio.h>
int main() {
int num1, num2, num3;
printf("Enter three integers: ");
scanf("%d %d %d", &num1, &num2, &num3);
OR
Write a program to print first 10 natural number using C language.
#include <stdio.h>
int main() {
int i;
for (i = 1; i <= 10; i++) {
printf("%d\n", i);
}
return 0;
}
b) Define digital footprint. How can you manage your digital footprint?
Ans: A digital footprint is the trail of data left behind by users on the internet. We can manage it by
controlling privacy settings, being cautious about sharing personal information, and regularly
reviewing online activities.
h) What is key in DBMS? Write any two name of keys available in DBMS.
Ans: A key in DBMS is an attribute or set of attributes that uniquely identifies a record. Two keys
are Primary Key and Foreign Key.
Debugged Program
REM WAP to create file “detail.dat” and insert some records.
CLS
OPEN "detail.dat" FOR APPEND AS #5
TOP:
INPUT "Enter name, class, and address"; n$, cl, a$
WRITE #5, n$, cl, a$
INPUT "Do you want to add more? (Y/N)"; C$
IF UCASE$(C$) = "Y" THEN GOTO TOP
CLOSE #5
END
Group C
(A4D)16 = (?)2
Convert each hex digit to 4 binary digits (see conversion table below):
A4D
=A4D
A = 1010
4 = 0100
D = 1101
= 101001001101
(A4D)16 = (101001001101)2
(37)10 = (?)8
(10101)2 / (101)2
101) 1 0 1 0 1 (100
1 0 1
0 0 0 0 1
0
1
Q=100
4|P a g e CS SEE GANDAKI 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
R=1
(1111)2 x (101)2
1 1 1 1
1 0 1
1 1 1 1
0 0 0 0 x
1 1 1 1 x x
1 0 0 1 0 1 1
9. a) Write a program in QBASIC that asks height and radius of cylinder and calculate its volume by user
define function and total surface area by sub procedure. [Vc=
DECLARE FUNCTION VOL (R, H)
DECLARE SUB AREA (R, H)
CLS
INPUT "Enter radius of the cylinder: ", R
INPUT "Enter height of the cylinder: ", H
PRINT "Volume of cylinder: "; VOL(R, H)
CALL AREA(R, H)
END
b) A sequential data file called “student.txt” has stored data under the field heading Name, Class, Address
and Age. Write a program to display all the information of those whose class is 10 and gender is “male”.
OPEN "student.txt" FOR INPUT AS #1
PRINT "Name", "Class", "Address", "Age"
10. Write a progam is C language to check the students whether that are pass or fail, when the pass mark is
45.
#include <stdio.h>
int main() {
int marks;
printf("Enter the marks: ");
scanf("%d", &marks);
#include <stdio.h>
int main() {
int sum = 0, i, term = 40;
for (i = 1; i <= 10; i++) {
printf("%d ", term);
sum += term;
term++;
}
printf("\nSum of the series: %d\n", sum);
return 0;
}
Dry run
C B I=2 TO 8 STEP 2 PRINT C; B=C+1
3 2 2 TO 8 STEP 2 YES 3
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
Group C
Calculate or convert as per the instructions.
(CA)16 = (?)10
(652)10 = (?)8
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
(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
4|P a g e CS SEE KARNALI 2080 https://seeqbasicomputer.blogspot.com/
SEE COMPUTER SCIENCE SET SOLUTIONS 2081 https://deepak2081.com.np/ SOLVED BY: DEEPAK SHRESTHA
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 FUNCTION VOL(R)
DECLARE SUB SPHERE(R)
CLS
INPUT "Enter Radius: "; R
PRINT “Volume of hemisphere”; VOL(R)
CALL SPHERE(R)
END
FUNCTION VOL(R)
VOL=(2/3) * 3.14159 * R^3
END FUNCTION
SUB SPHERE(R)
TSA = 4 * 3.14159 * R^2
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.
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);
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;
}