SEE Computer Science Specification Table 2076, Networking and Telecommunication, Ethical and Social Issues in ICT, Computer Security, E-Commerce, Contemporary Technology, Number System, Database Management System (MS Access), Modular Programming, Sequential File Handling, C Programming Basics, SEE Computer E-Book Grade IX and X
Sunday, January 5, 2025
Saturday, January 4, 2025
COMPUETR SCIENCE SEE 2078 - SEE 2081 Grade Increment Questions and Answers Solutions. [Total 159 Questions Collections Along with Solutions.]
SEE 2078 - SEE 2081 Grade Increment Questions and Answers Solutions. [Total 159 Questions Collections Along with Solutions.]
Answer the following
questions.
1.
What
is computer network? Enlist any two advantages of it.
Any two advantages 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.
2.
What is
unguided media?
Unguided media is
a communication channel in which data and information are transferred through
the air using electromagnetic waves, such as radio waves or microwaves without
using wire or cable.
3.
Give the name of any two unguided transmission media
Any two unguided
transmission media are Microwave and Radio wave.
4.
What is
network protocol?
A set of rules
followed for interconnection and communication between computers in a network
is called network protocol.
5.
Define
network topology. Sketch a drawing of star topology.
Network topology
refers to the layout or inter - connected pattern of computers and devices in a
network.
Sketch of star topology
6.
List any two
types of network topology.
Two
types of network topology are star topology and bus topology.
7.
Define Bus topology? Write any two advantages of Bus
topology.
The type of
topology in which all nodes and network devices are connected to single cable
is called bus topology.
Any two advantages
of Bus topology are:
· It is cost
effective and cable required is least compared to other network topology.
· It is used in
small networks and easy to expand networks.
8.
Mention any
two services provided by Internet.
Any two services provided by Internet are E-Commerce and
E-Mail
9. What
is search engine?
A search engine is
an online tool that helps users find information on the internet using keywords
or phrases and provide relevant results.
10.
Write the
name of any two search engines.
The name of any two search engines is google and bing.
11.
What is web
browser?
Web browser is a
computer program that access web pages and displays them on the user’s computer.
12. What is computer ethics?
Computer ethics is a set of moral
principles or code of conducts that regulate the use of computers
systematically without making harm to other users.
13.
Write any
four commandments of computer ethics.
Any four commandments of computer ethics are:
· Do not use a computer to publish fake information.
· Do not search the file or record of other people.
· Do not destroy or delete the records of other people.
·
Do not use a computer to steal
someone's privacy.
14.
What is
social media?
Social media refers to online platforms like Facebook and
Instagram that allow people to connect, share
information, and interact with each other.
15. Write any one
reason why social media is popular now days.
Social media is popular now a days
because it enables instant communication, allowing people to connect and share
information globally in real-time.
16. Write any two advantages and disadvantages of social media.
Any two advantages of social media are:
· It creates
awareness and innovate the way people live.
· Social media let
us share anything with others around the world.
Any two disadvantages of social media are:
· Personal data and
privacy can be easily hacked and shared on the internet.
· More chances of
creating fake accounts.
17.
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
18.
Define cyber
law and cyber crime.
The law which governs the legal issues in the cyber
space regarding the internet or WWW for digital data processing and transaction
is called cyber law.
Cyber
crime refers to criminal activities that are carried out using computers or the
internet.
19.
What is
computer security? Write any two protection measures of software security.
Computer
security
refers to the protection of computer systems and data from unauthorized access,
theft or misuse and damage and action to prevent such
incidents.
Any two protection measures for software security are: Backup and
Password
20.
What
is software security? Write any two measures of hardware security.
Software security means protecting software from being hacked or misused which
ensures the software works properly and keeps data safe.
Any two measures of hardware security are:
Insurance and Power Protection Device
21.
What is Backup? How it helps to secure data?
Backup is the
system of copying data and programs into another location or creating a
duplicate copy of it in a secured place.
A backup secures
data by creating a duplicate copy stored separately from the original,
protecting against data loss due to hardware failure, accidental deletion,
cyber threats, and disasters. It ensures data can be restored if the original
is compromised, maintaining data integrity and availability for recovery.
22.
What is
password? Write any two importance of password protection.
Any two importance of password
protection are:
· Password secures
the data by protecting from unauthorized access.
· It safeguards
personal information from being stolen or misused.
23.
What is
antivirus software? Name any two popular antivirus software.
Antivirus software is a program that
scans, detects, and removes malicious software from a computer or device to
protect it from security threats.
Any two popular antivirus software are Kaspersky and Norton
Antivirus.
24.
Write ant
two symptoms of computer virus.
Ans: Any symptoms of computer virus are:
· Program takes long time to load.
· Increased use of disk space and growth in file size.
25.
What is
Ecommerce?
E-commerce
refers to the buying and selling of goods and services over the internet.
26.
Write any
two benefits of e-commerce.
Any two benefits of e-commerce are:
· Faster
buying/selling procedure, as well as easy to find products.
· There are no
geographical limitations, can deliver service globally.
27. Write any two
names of Nepali e-commerce sites.
Any two names of
Nepali e-commerce sites are daraz and hamrobazar.
28. What
is the business done through internet?
The business done through internet is
e-commerce.
29.
What is the
business done through the mobile?
The business done through the mobile is M-Commerce
30. What is M-Commerce? Write any two important services.
M-commerce (Mobile
Commerce)
refers to buying, selling, and conducting business transactions through mobile
devices like smartphones and tablets.
Any two
important services are: mobile banking and mobile shopping.
31. Give two
differences between E-commerce and Traditional Commerce.
Two differences between E-commerce and Traditional Commerce
are
Traditional Commerce |
E-commerce |
Traditional commerce is the buying
and selling of goods and services through physical stores and in-person
transactions, without using digital technology. |
Ecommerce refers
to the buying and selling of goods or services using the internet. |
Delivery of goods is instant. |
Delivery of goods takes time. |
32. What is IoT? Write any two importance of it.
IoT (Internet of Things) refers to a
network of interconnected devices that communicate and share data over the
internet.
Any two importance of IoT are:
·
Information
is easily accessible from any place at any time on any device.
· Tasks
can be performed automatically without human intervention.
33. Define
Artificial Intelligence with examples.
Artificial Intelligence (AI) refers to the simulation
of human intelligence in machines that are programmed to think and learn like
humans.
Examples of
AI are self-driving cars, speech recognition (Siri) , face recognition etc.
34. Write
any two uses of AI.
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.
35. Define
virtual reality. Write any two areas where virtual reality is used.
Virtual Reality (VR)
is a technology that creates a simulated (virtual) world where users can feel
and interact with things as if they are real, using devices like VR headsets
and gloves.
Any two areas where virtual reality is used are : Gaming and
Education & Training (medical or flight training).
36. Write
any two benefits of e-governance service.
Any two benefits of e-governance
service are:
Citizens
can access government services and information conveniently from anywhere.
E-governance systems promote transparency by making government
actions and decisions visible to the public.
37.
What
is database? Give any two examples.
A collection of
systematically organized inter-related data which store, organize and retrieve
data is called a database. E.g.
Dictionary and Telephone Directory.
38.
Write any
two elements of database.
Field and Record are the two elements of database
39.
What is the
default extension of MS-Access?
The default extension of Ms-Access is : .mdb (2003 version)
and .accdb (2007 version).
40. Define DBMS with
any two examples of it.
DBMS is a computerized system that stores data,
processes them and provides information in an organized form.
Any two examples
of DBMS are : MS-Access and Oracle.
41.
Write any
two advantages of DBMS.
Any two advantages of DBMS are:
· It reduces data
redundancy which means duplication of data.
· Large volume of
data can be stored and updated easily.
42.
Write four
objects of MS-Access.
Any four objects of MS-Access are
Table, Form, Query and Report.
43.
What is the
default size of text field in MS-Access?
The default size of a text field is
50 characters (2003 version) and 255 characters (2007 version) in MS-Access.
44. List any four features of MS-Access.
Any four
features of MS-Access are:
· It provides the flexible ways to add, edit, delete and
display the related data.
· Queries help to view, change and analyse the data
indifferent ways.
· Forms are used for viewing and editing the information.
· Reports are used for summarizing and printing the data.
45. 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.
46.
Which data
type is used to store date of birth in MS-Access?
Date/Time is the data type is used to store date of birth in
MS-Access
47.
Which data
type is suitable to store photographs of students in MS-Access?
The suitable data type to store photographs of students in
MS-Access is OLE object.
48.
Which in the
logical data type of MS-Access?
The logical data type of MS-Access is Yes/No.
49. Which
view is used to modify a table
structure in MS-Access?
Design view is used to modify a table in
MS-Access
50.
What is the maximum length of the field name in
MS-Access?
The maximum length
of the field name in MS-Access is 64 characters.
51. Define field and record.
A field is a column in a table which contains
information about a certain type for all records. Field is a smallest unit of
information.
A record is a row
in a table which contains information about single items in a database. Record
is complete set of information
52.
Identify a
record and field from the following table structure:
Symbol No. |
Name |
Marks |
00100202S |
Aarambha Shrestha |
91 |
00100203T |
Suhisha Rayamajhi |
99 |
Fields are Symbol No. , Name and
Marks
Record 1 is 001002020S, Aarambha
Shrestha, 91
Record 2 is 00100203T, Suhisha
Rayamajhi, 99
53. List the field name from the following table structure.
Symbol
No. |
Name |
Marks |
00100200Q |
Surya
Gurung |
85 |
00100201R |
Birendra
Sharma |
91 |
The field names are Symbol No., Name and Marks.
54. What are validation text and validation rule?
Validation Text is
a field property which displays an error message that appears if the data
entered is invalid according to the specified validation rule.
Validation
Rule is a field property which is used to limit the values that can be entered
into a field.
55. What is primary key? List any two advantages of
it.
A primary key is a
unique field in a database table that identifies each record uniquely.
Any two advantages of primary key are:
· It sets the
relationship between tables.
· It reduces and
controls duplication of record in a table.
56. Why is primary key necessary in record?
A primary key is necessary in a database record because it reduce and control
duplication of the record in a table, sets the relationship between tables and
identifies each record of a table uniquely.
57. What is data sorting? List any two advantages of
using it.
The process of arranging all the records in a table
either ascending or descending order based on field or fields is known as
sorting.
Any two advantages of sorting are:
· Sorting helps to
organize data and make it easier to find and retrieve specific information.
· Sorting can save
time and improve efficiency by allowing users to quickly access the data they
need.
58. 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.
59. What is form? Write any two advantages of it.
Form is one of the
MS-Access database objects which provides graphical interface to view, modify
and add data in a table or multiple linked tables.
Any two advantages of form are:
· Form displays
complete record one at a time, so we can view and modify records using the
form.
· Forms provides GUI
(Graphical Users Interface) using which users interact with MS-Access database.
60.
What is query? List two types of it.
Query is an object of database that is used to view,
retrieve, change and analyze records from a table or multiple linked tables
based on specified condition.
The types of query are: Select Query and Action Query
(Update query, Delete query, Append query and Make Table query)
61.
Which object
of MS-Access is used to retrieve data from the table?
Query is used to retrieve data from a table.
62.
Which type of query do you use to calculate the total
marks of students from table in MS Access?
Select Query is
used to calculate the total marks of students from table in MS Access
63. Give the differences between the Select Query and Action
Query.
The
difference between select query and action query are:
Select Query |
Action Query |
Select query is simply used to select and display the
relevant data from the database. |
An action query is a query that makes changes to or
removes many records in just one operation. |
It does not make change to database. |
It makes change to database. |
64. Define report and
mention any two uses of it.
Report is one of the MS-Access database objects used
to present information in an effective and organized format that is ready for
printing.
Any two uses of
report are:
· Reports provide a formatted presentation of data that is
easy to read and understand.
· Reports enable users to summarize, analyze, and visualize
data in meaningful ways.
65. Mention the importance of report in database.
The importance of report is to print documents according to
user’s specifications of the summarized information through query or table.
66. What
is modular programming?
Modular programming is a technique used to
divide program into many small, manageable, logical and functional modules or
blocks.
67.
Write any
one advantage of Modular Programming.
Any one advantage of Modular Programming is it is easy to
design, code and test the program modules independently.
68.
List the different types of procedures in QBasic.
The different
types of procedures are: Sub Procedure and Function Procedure
69.
Which
statement is used to call sub-procedure?
CALL statement is used to call sub-procedure.
70.
What is
looping?
Looping
is the process of repeating the execution of a statement or a block of
statements until a specific condition is satisfied.
71. Write
any two features of C language.
Any two features of C language are:
Portability: C
code can be compiled and executed on different systems with minimal
modifications.
C is a
case-sensitive programming language. It understands the capital alphabets and
small alphabets as different values.
72.
List any two
data types used in C-programming language.
Any two data types used in C-programming language are char
and int.
73.
Which format specifier do you use in C language for
'int' data type ?
%d format
specifier is used in C language for 'int' data type.
2. Write
appropriate technical term for the following:
1.
Data transmission in only one direction. Simplex
Mode
2.
Network of
networks. Internet
3.
A company which provides services of
Internet. Internet Service Provider (ISP)
4.
Digital trails created while using internet. Digital
Footprint
5. Law that governs the legal issues of cyberspace.
Cyber Law
6.
A secret
group of characters used to protect computer system from unauthorized
users. Password
7.
A system of
copying data and information reading in computer into another location. Backup
8.
A program
that can disinfect a file from virus. Antivirus software
9.
Computer
program that protects computer from computer virus. Antivirus Software
10.
Learning
through the electronic media. E-Learning
11. An artificial environment created by a computer system that
appears real. Virtual reality
12.
The smallest unit to
represent information on a quantum computer Qubit (Quantum bit)
3. Write the full
form of the following:
1.
STP - Shielded Twisted
Pair
2.
NIC
- Network Interface Card
3.
MAN - Metropolitan Area Network
4.
URL - Uniform Resource Locator
5. WAP - Wireless Application Protocol
6.
POP - Post Office Protocol
7. FTP - File Transfer Protocol
8.
OTP
- One Time Password
9. ISP - Internet Service Provider
10. G2G - Government to Government
11. IoT - Internet of Things
12. AI - Artificial Intelligence
1. Write the output
of the given program: Show with dry run in
table. [2]
DECLARE
SUB SHOW(A)
CLS
N=87
CALL
SHOW(N)
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
Dry
run table
N |
A |
B =A MOD 6+3 |
B MOD 4=0 |
PRINT B; |
A=A-10 |
|
87 |
87 |
87 MOD 6 + 3=6 3+3=6 |
6 MOD 4=0 2=0 NO |
6 |
87-10=77 |
77>=50 yes |
|
77 |
77 MOD 6 + 3 =8 5+3=8 |
8 MOD 4=0 0=0YES |
|
77-10=67 |
67>=50 yes |
|
67 |
67 MOD 6 + 3=4 1+3=4 |
4 MOD 4=0 0=0 YES |
|
67-10=57 |
57>=50 yes |
|
57 |
57 MOD 6 + 3=6 3+3=6 |
6 MOD 4=0 2=0 NO |
6 |
57-10=47 |
47>=50 no |
|
47 |
|
|
|
|
|
The output of a program is:
6 6
2. 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
FUNCTION Series
(N)
Sum=0
FOR J = 1 TO 4
Sum=Sum + N
N=N+3
NEXT J
Series= Sum
END FUNCTION
Dry Run
A |
PRINT "Sum of the
series"; Series (A) |
N |
Sum |
FOR J = 1 TO 4 |
Sum=Sum + N |
N-N+3 |
Series = Sum |
2 |
Sum of the series 26 |
2 |
0 |
1 TO 4 Yes |
0+2=2 |
2+3=5 |
|
|
|
5 |
2 |
2 TO 4 Yes |
2+5=7 |
5+3=8 |
|
|
|
8 |
7 |
3 TO 4 Yes |
7+8=15 |
8+3=11 |
|
|
|
11 |
15 |
4 To 4 Yes |
15+11=26 |
11+3-=14 |
|
|
|
14 |
26 |
5 To 4 No Loop Exits |
|
|
26 |
The output of the
program is:
Sum of the series
26
3. Write down the output of the given program and
show them in dry run table:
DECLARE FUNCTION SQN (N)
CLS
S=0
FOR L=1 TO 3
READ NUM
S=S+SQN (NUM)
NEXT L
PRINT "Sum of square"; S
DATA 1, 4, 5
END
FUNCTION SQN (N)
SQN = N^2
END FUNCTION
Dry Run
S |
L=1 TO 3 |
Read Num |
S=S+SQN(NUM) |
SQN=N^2 |
0 |
1 TO 3 yes |
1 |
0+1=1 |
1^2=1 |
17 |
2 TO 3 yes |
4 |
1+16=17 |
4^2=16 |
42 |
3 TO 3 yes |
5 |
17+25=42 |
5^2=25 |
|
4 TO 3 No Loop Exits |
|
|
|
The output of the program is :
Sum of square 42
4. Write down the output of the given program:
DECLARE SUB Series(A)
CLS
A=20
CALL Series(A)
END
SUB Series(A)
FOR K=1 to 5
PRINT A;
A=A+10
NEXT K
END SUB
Dry Run Table
A |
K=1 to 5 |
PRINT A; |
A=A+10 |
20 |
1 to 5 yes |
20 |
20+10=30 |
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 |
|
|
The output of the program is:
20 30 40 50 60
5. Write down the output of the given program. Show in dry
run table.
DECLARE SUB Result (C$)
C$= “COMPUTER"
CALL Result (C$)
END
SUB Result (C$)
FOR C=1 TO LEN(C$) STEP 2
M$=MIDS (C$,C,1)
N$=N$+MS
NEXT C
PRINT N$
ENF SUB
Dry Run
C$ |
C=1 To LEN(C$) STEP 2 |
MS=MID$(C$,C,1) |
N$=N$+M$ |
PRINT N$ |
COMPUTER |
1 to 8 step 2 |
MID$(COMPUTER,1,1) =C |
C |
|
|
3 to 8 step 2 |
MID$(COMPUTER,3,1) =M |
C+M=CM |
|
|
5 to 8 |
MID$(COMPUTER,5,1) =U |
CM+U=CMU |
|
|
7 to 8 |
MID$(COMPUTER,7,1) =E |
CMU+E=CMUE |
|
|
9 to 8 Loop exits |
|
|
CMUE |
Output
CMUE
6. 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;
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
1. Re-write the
given program after correcting the
bugs: [2]
REM
to add record in an existing file
CLS
OPEN
“Record.Dat” FOR OUTPUT AS #1
AA:
INPUT
“Enter Name, Class and Roll No.”; Nm$, Cl, Rn
INPUT
#2, Nm$, Cl, Rn
INPUT
“More records”; Y$
IF
UCASE$(Y$)=”Y” THEN GOTO aa
CLOSE
“Record.dat”
END
Debugged program:
REM
to add record in an existing file
CLS
OPEN
“Record.Dat” FOR APPEND AS #1
AA:
INPUT
“Enter Name, Class and Roll No.”; Nm$, Cl, Rn
WRITE #1,
Nm$, Cl, Rn
INPUT
“More records”; Y$
IF
UCASE$(Y$)=”Y” THEN GOTO AA
CLOSE #1
END
2. Re-Write the
given program after correcting the bags:
REM to display
name, post and salary of 10 employees
OPEN
"EMP.TXT" FOR IN AS #1
FOR I=10 TO 1
INPUT #1, Name$,
Post$, Salary
DISPLAY Name$,
Post$, Salary
NEXT I
CLOSE “EMP.TXT”
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
3. Re-Write the given program after correcting the bugs:
DECLARE SUB Square (A)
REM to print square of a input number
CLS
GET "Enter a number"; N
Square (N)
END
SUB Square (A)
Sq = A^ 4
Display "Square of a number is "; Sq
End Sub
Debugged Program
DECLARE SUB Square (A)
REM to print square of a input number
CLS
INPUT "Enter
a number"; N
CALL Square
(N)
END
SUB Square (A)
Sq = A^ 2
PRINT "Square
of a number is "; Sq
End SUB
4. Re-Write the given program after correcting the bugs:
REM program to make a word reverse
DECLARE FUNCTION Rev$(N$)
CLS
LNPUT “Enter a word”; N$
DISPLAY “Reversed is”; Rev$(N$)
END
EUNCTION Rev$(N$)
FOR K=LEN$(N$) To 1 STEP-1
B$=B$+MID$(N$,1,K)
NEXT K
B$=Rev$
END FUNCTION
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
5. 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
6. Re-write the given program after correcting the
bugs: 2
DECLARE SUB Series ( )
CLS
EXECUTE Series
END
SUB Series( )
REM Program to generate 1 1 2 3 5 .....upto the 20th terms
A=1
B=1
FOR ctr=10 to 1
DISPLAY A:B:
A=A+B
B=A+B
NEXT ctr
END Series ( )
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
1. Study the following program and answer the
given
questions. [2×1=2]
OPEN
“Detail.dat” FOR INPUT AS #1
OPEN
“Temp.dat” FOR OUTPUT AS #2
INPUT
“Enter name of the students”; S$
FOR
I=1 TO 10
INPUT
#1, Nm$, Cl, A
IF
S$< >Nm$ THEN
WRITE
#2, Nm$, Cl, A
END
IF
NEXT
I
CLOSE
#1, #2
KILL
“Detail.dat”
NAME
“Temp.dat” AS “Detail.dat”
END
a. What is the main
objective of the program given above?
The main objective of the program is to delete the
record of a specific student, identified by their name from the data file Detail.dat.
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.
2. Study the
following program and answer the given questions:
DECLARE SUB SEE
(A$)
A$="COMPUTER
SCIENCE”
END
SUB SEE (A$)
L=LEN(A$)
FOR I=L TO 1
STEP-2
PRINT MID$ (A$, I,
1)
NEXT I
END SUB
a) Which statement
should be added in the main module to execute the program?
Ans: CALL SEE(A$)
should be added in the main module to execute the program
b) List out the
variables used in the above program.
Ans: The variables
used in the above program are: A$, L and I .
3. Study the following program and answer the given
questions:
DECLARE FUNCTION Count (W$)
INPUT "Enter a word"; R$
C = Count (R$)
PRINT C
END
FUNCTION Count (W$)
FOR L = 1 TO LEN (W$)
Ch$MID$ (W$, L, 1)
IF UCASES (Ch$) = "K" THEN
N=N+1
END IF
NEXT L
Count = N
END FUNCTION
a) List any two library functions used in the above program.
UCASE$( ) and MID$( ) are the two library functions used in
the above program
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( ).
4. Study the following program and answer the given
questions:
DECLARE FUNCTION SUM(N)
CLS
INPUT “Enter any number”; N
X=SUM(N)
PRINT “The sum of individual digit is “; X
END
FUNCTION SUM(N)
WHILE N<>0
R=N MOD 10
S=S+R
N=INT(N/10)
WEND
SUM=S
END FUNCTION
a) Write the function of INT.
Ans: The INT function returns the integer part of a number,
removing the decimal part.
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.
5. Study the following program and answer the given questions.
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
List all the numerical variables used in the program above.
Ans: The numerical variables used in the program above are
A, B and P
List the local variables used in program above.
Ans: The local variables used in the program above is P.
6. 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
a) How many parameters are used in the above program?
Ans: One parameters is used in the
above program.
b) How many times does the statement S=S+I execute in the
above program?
The statement S=S+I will execute 100
times in the above program
8. Convert /
Calculate as per the instruction. [4×1=4]
a. (11001101)2 =
(?)16
Soln:
Converting Binary to octal
Binary
value in four bits |
1100 |
1101 |
Octal
number |
C |
D |
(11001101)2 = (CD)16
a) (10110011)2 – (?)16
Soln:
Paired Binary Digit |
1011 |
0011 |
Binary Equivalent value |
B |
3 |
(10110011)2 = (B3)16
i) (11111101)2 = (?)16
Soln:
Paired Binary Digit |
1111 |
1101 |
Binary Equivalent value |
F |
D |
(11111101)2 = (FD)16
i) (10011011)2
= (?)8
Convert every 3
binary digits (from bit0) to octal digit (see conversion table below):
10011011
010 = 2
011 = 3
011 = 3
= 2 3 3
= (10011011)2
= (233)8
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
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
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
i) (214) 10 = (?)2
Divide by the base 2 to get the digits from the remainders:
Division |
Quotient |
Remainder (Digit) |
(214)/2 |
107 |
0 |
(107)/2 |
53 |
1 |
(53)/2 |
26 |
1 |
(26)/2 |
13 |
0 |
(13)/2 |
6 |
1 |
(6)/2 |
3 |
0 |
(3)/2 |
1 |
1 |
(1)/2 |
0 |
1 |
= (11010110)2
(214) 10 = (11010110)2
ii) (245)10 = (?)2
Soln:
2 |
245 |
Remainder |
2 |
122 |
1 |
2 |
61 |
0 |
2 |
30 |
1 |
2 |
15 |
0 |
2 |
7 |
1 |
2 |
3 |
1 |
2 |
1 |
1 |
|
0 |
1 |
(245)10 = (11110101)2
ii) (524)10 =
(?)2
2 |
524 |
Remainder |
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
ii) (99)10
= (?)16
Divide by the base
16 to get the digits from the remainders:
Division |
Quotient |
Remainder (Digit) |
(99)/16 |
6 |
3 |
(6)/16 |
0 |
6 |
= (63)16
(99)10
= (63)16
a) (ABC)16 = (?)8
Convert each hex digit to 4 binary digits
ABC
= A B C
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
ii) (ABC) 16 = (?)2
Convert each hex digit to 4 binary digits (see conversion
table below):
ABC
= A B C
A= 1010
B=1011
C=1100
= 101010111100
(ABC) 16 = (101010111100)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
c. (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
iii) (10110)
2 x (101)2 = (?)2
|
|
|
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 |
|
|
|
|
|
|
|
|
10110 × 101
= 1101110
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
c)
(1001 + 110)2 – (1000)2
|
1 |
0 |
0 |
1 |
|
+ |
1 |
1 |
0 |
|
1 |
1 |
1 |
1 |
- |
1 |
0 |
0 |
0 |
|
0 |
1 |
1 |
1 |
(1001 + 110)2 – (1000)2 = (0111)2
iii)
(1011) 2 × (101) 2 + (101) 2 =(?)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 |
Now,
1
1 0 1 1 1
+
1 0 1
1
1 1 1 0 0
(1011) 2 ×
(101) 2 + (101) 2 =(?)2 =(111100)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
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 |
(1010) 2 x (101) 2 =(110010)2
iv) (101101)2 / (11) 2
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
iv) (101101) /¸(101)
|
101) |
1 |
0 |
1 |
1 |
0 |
1 |
(1001 |
|
- |
1 |
0 |
1 |
|
|
|
|
|
|
0 |
0 |
0 |
1 |
0 |
1 |
|
|
|
|
|
- |
1 |
0 |
1 |
|
|
|
|
|
|
0 |
0 |
0 |
|
|
|
|
|
|
|
|
|
|
Quotient = 1001
Remainder = 0
iv) (10110) 2 ¸ (101) 2
101) |
10110( |
100 |
|
-101 |
|
|
00010 |
|
|
-0 |
|
|
10 |
|
Quotient
= 100
Remainder
= 10
iv) (10101)2 / (11)2
11) |
1 |
0 |
1 |
0 |
1 |
(111 |
|
|
1 |
1 |
|
|
|
|
|
1 |
0 |
0 |
|
|
|
|
|
1 |
1 |
|
|
|
|
0 |
0 |
1 |
1 |
|
|
|
|
|
1 |
1 |
|
|
|
|
|
0 |
0 |
|
Q=111
R=0
iv) (101110) 2 ¸ (110) 2
11) |
10101 |
111 |
|
|
|
|
-11 |
|
|
100 |
|
|
- 11 |
|
|
11 |
|
|
-11 |
|
|
00 |
|
Quotient = 111
Remainder = 00
iv) (101110) 2 ¸ (110) 2
110) |
101110( |
0111 |
|
000 |
|
|
1011 |
|
|
-110 |
|
|
1011 |
|
|
-110 |
|
|
1010 |
|
|
-110 |
|
|
100 |
|
Quotient
= 111
Remainder = 100
1. 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]
DECLARE FUNCTION AREA(L,B)
DECLARE SUB VOL(L,B,H)
CLS
INPUT “Enter Length”; L
INPUT “Enter Breadth”; B
INPUT “Enter Height”; H
PRINT “Area of room=”; AREA(L,B)
CALL VOL(L,B,H)
END
FUNCTION AREA(L,B)
AREA = L * B
END FUNCTION
SUB VOL(L,B,H)
V=L*B*H
PRINT “Volume of Room=”; V
END SUB
2. 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=2pr (r+h) and Volume
pr2h]
DECLARE FUNCTION AREA(R, H)
DECLARE SUB VOL(R,H)
Cls
INPUT "Enter radius"; R
INPUT "Enter height"; H
PRINT AREA(R, H)
Call VOL(R, H)
END
FUNCTION AREA (R, H)
AREA = 2 * 3.14 * R * (R +
H)
END FUNCTION
SUB VOL (R, H)
V = 3.14 * R ^ 2 * H
PRINT "Volume of cylinder";
V
END SUB
3. Write a program in QBASIC that asks radius of a circle to
calculate its area and circumference. Create a user defined function to
calculate area and sub program to calculate circumference.
[Hint A= pr2, C= 2pr]
DECLARE FUNCTION AREA (R)
DECLARE SUB CIR (R)
CLS
INPUT “ENTER RADIUS”; R
PRINT “AREA OF SQUARE ”; AREA(R)
CALL CIR (R)
END
FUNCTION AREA (R)
AREA = 3.14 * R ^ 2
END FUNCTION
SUB CIR (R)
C = 2 * 3.14 * R
PRINT “CIRCUMFERENCE OF CIRCLE”; C
END SUB
4. Write a program in Q-BASIC that asks length and 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: A=L×B,
P=2(L+B)]
DECLARE FUNCTION AREA(L,B)
DECLARE SUB PER(L,B)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
PRINT “AREA OF A ROOM=”; AREA(L,B)
CALL PER(L,B)
END
FUNCTION AREA(L,B)
AREA=L*B
END FUNCTION
SUB AREA(L,B)
P=2*(L+B)
PRINT “PERIMETER OF RECTANGLE=”; P
END SUB
1. Write a program
to create a sequential data file "student.dat" to store 10 students
name and obtain marks in four different subjects.
OPEN "student.dat"
FOR OUTPUT AS #1
FOR I = 1 TO 10
INPUT "Enter Name"; N$
INPUT “Enter Marks in English”; E
INPUT “Enter Marks in
Nepali”; NE
INPUT “Enter Marks in
Maths”; M
INPUT “Enter Marks in
Science”; S
WRITE #1, N$, E, NE, M, S
NEXT
I
CLOSE #1
END
2. 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.
OPEN “salary.dat” FOR OUTPUT AS #1
DO
CLS
INPUT “Enter name”; N$
INPUT “Enter Salary”; S
INPUT “Enter Post”; P$
WRITE #1, N$, S, P$
INPUT “Do you want to continue(Y/N)”; CH$
LOOP WHILE UCASE$(CH$)=”Y”
CLOSE #1
END
3. 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
WHILE NOT EOF(1)
INPUT #1, N$, C, S$, A$
PRINT N$, C, S$, A$
WEND
CLOSE #1
END
4. Employee's name, address, gender and salary are stored in
the "EMP.DAT" sequential data file. Write a QBASIC program that
displays all information about personnel whose salaries exceed 60000.
OPEN "EMP.DAT" FOR INPUT AS #1
CLS
WHILE NOT EOF (1)
INPUT #1, N$, A$, G$, S
IF S > 60000 THEN PRINT N$, A$,
G$, S
WEND
CLOSE #1
END
5. 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.
OPEN
"Record.dat" FOR INPUT AS #1
CLS
WHILE
NOT EOF (1)
INPUT
#1, R, N$, G$, E, NP, M, C
IF
E > 40 THEN PRINT R, N$, G$, E, NP, M, C
WEND
CLOSE
#1
END
6. 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
1. 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;
}
2. 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;
}
3. 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;
}
4. 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;
}
5. 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;
}
6. Write a C program that asks a number and check whether it
is negative, positive 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;
}
7. Write a program in C language that asks any two numbers
and displays the greatest among them.
#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;
}
8. 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;
}
9. 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;
}
}
10. 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;
}
11. Write a program in C language to display first 10 odd
numbers.
#include<stdio.h>
#include<conio.h>
int main() {
int i, a;
i=1;
a=1;
while(i<=10) {
printf("%d \n", a);
a=a+2;
i++;
}
return 0;
}