Wednesday, March 26, 2025
Sunday, March 23, 2025
FILE HANDLING (SOLVED)
FILE HANDLING (SOLVED)
1. Write a QBASIC program to create a file named including the name, class, and roll number of a student.
OPEN "std.dat" FOR OUTPUT AS #1
CLS
INPUT "Enter student name: ", name$
INPUT "Enter student class: ", class$
INPUT "Enter roll number: ", roll$
WRITE #1, name$, class$, roll$
CLOSE #1
PRINT "Student data saved successfully in std.dat!"
END
2. Write program to read and display the name, class and roll number of students.
CLS
OPEN "std.dat" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, name$, class$, roll$
PRINT "Name: "; name$; ", Class: "; class$; ", Roll No.: "; roll$
LOOP
CLOSE #1
END
3. Read data from a file and calculate total marks:
CLS
OPEN "marks.dat" FOR INPUT AS #1
total = 0
DO WHILE NOT EOF(1)
INPUT #1, marks
total = total + marks
LOOP
PRINT "Total Marks: "; total
CLOSE #1
END
4. Search for a specific student's data in:
CLS
OPEN "records.dat" FOR INPUT AS #1
INPUT "Enter name to search: ", searchName$
found = 0
DO WHILE NOT EOF(1)
INPUT #1, name$, details$
IF name$ = searchName$ THEN
PRINT "Details: "; details$
found = 1
END IF
LOOP
IF found = 0 THEN PRINT "Student not found!"
CLOSE #1
END
5. Count and display the number of records in a file:
CLS
OPEN "students.dat" FOR INPUT AS #1
count = 0
DO WHILE NOT EOF(1)
LINE INPUT #1, data$
count = count + 1
LOOP
PRINT "Total Records: "; count
CLOSE #1
END
6. Display specific fields from (e.g., names only):
CLS
OPEN "data.dat" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, name$, info$
PRINT "Name: "; name$
LOOP
CLOSE #1
END
7. Write a QBASIC program to create a file named including the name, class, and roll number of a student.
CLS
OPEN "std.dat" FOR OUTPUT AS #1
INPUT "Enter student name: ", name$
INPUT "Enter student class: ", class$
INPUT "Enter roll number: ", roll$
WRITE #1, name$, class$, roll$
CLOSE #1
PRINT "Student data saved successfully in std.dat!"
END
8. Write a QBASIC program to create a text file named . The file should store the names and marks of five students entered by the user.
OPEN "StudentInfo.txt" FOR OUTPUT AS #1
CLS
FOR i = 1 TO 5
INPUT "Enter student name: ", name$
INPUT "Enter student marks: ", marks
WRITE #1, name$, marks
NEXT i
CLOSE #1
PRINT "Data written to StudentInfo.txt successfully!"
END
9. Write a QBASIC program to read and display the contents of a text file named . Assume the file contains student names and grades.
CLS
OPEN "Grades.txt" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, name$, grade$
PRINT "Name: "; name$; ", Grade: "; grade$
LOOP
CLOSE #1
END
10. Write a QBASIC program that appends new records (names and scores) to an existing file called without overwriting its current contents.
CLS
OPEN "Results.txt" FOR APPEND AS #1
INPUT "Enter name: ", name$
INPUT "Enter score: ", score
WRITE #1, name$, score
CLOSE #1
PRINT "Record added to Results.txt successfully!"
END
11. Write a QBASIC program to count and display the total number of lines present in a text file named.
CLS
OPEN "Data.txt" FOR INPUT AS #1
lineCount = 0
DO WHILE NOT EOF(1)
LINE INPUT #1, text$
lineCount = lineCount + 1
LOOP
PRINT "Total number of lines: "; lineCount
CLOSE #1
END
12. 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'.
OPEN “STUDENT.DAT” FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
INPUT #1, R, CL, SE$, N$, D$, G$
IF UCASE$(G$)=”FEMALE” AND CL=9 THEN
PRINT R, CL, SE$, N$, D$, G$
END IF
WEND
CLOSE #1
END
Friday, March 21, 2025
Important Points: Computer Programming
Computer Programming/Modular Programming/File Handling
- Modular Programming: Process of writing program in multiple modules
- Main Module: The main part of the program inside which several sub modules are created
- Sub program: A group of statements written in a separate module to perform one or more tasks
- Formal Parameter: Parameter used while declaring and defining sub-program or user-defined functions
- Actual Parameter: Parameter used while calling sub-procedure or user defined function
- Local Variable: The variable which is recognized only inside the module where it is declared
- Global Variable: The variable which can be accessed from all the modules.
- File Handling: File handling is a mechanism to work with file so that we can read and write data from and into a disk file through QBASIC program.
- Output Mode: Output mode creates a new file and opens it to store data.
- Append Mode: Append mode opens an existing file to add records.
- Input Mode: Input mode opens and existing file to read records.
- File management command: File management command operates various task in a program. (Ex. FILES, MKDIR, CHDIR, RMDIR, NAME...AS, KILL and SYSTEM)
Full Forms: DBMS
DBMS
DBMS: Database Management System
RDBMS: Relational Database Management System
SQL: Structured Query Language
DDL: Data Definition Language
DML: Data Manipulation Language
ACID: Atomicity, Consistency, Isolation, Durability
ODBC: Open Database Connectivity
DAO: Data Access Objects
VBA: Visual Basic for Applications
OLE: Object Linking and Embedding
Full Forms: Contemporary Technology
Contemporary Technology
e-Commerce: Electronic Commerce
IaaS: Infrastructure as a Service
SaaS: Software as a Service
PaaS: Platform as a Service
AI: Artificial Intelligence
VR: Virtual Reality
ICT: Information and Communication Technology
E-Gov: Electronic Government
WiFi: Wireless Fidelity
GPS: Global Positioning System
W-LAN: Wireless Local Area Network
QoS: Quality of Service
IoT: Internet of Things
Full Forms: E-Commerce
E-Commerce
EDI: Electronic Data Interchange
B2C: Business to Consumer
B2B: Business to Business
C2C: Consumer to Consumer
M-Commerce: Mobile Commerce
PDA: Personal Digital Assistant
EFT: Electronic Funds Transfer
CoD: Cash on Delivery
EFTPOS: Electronic Funds Transfer at Point of Sale
Full Forms: Computer Security
Computer Security
CD: Compact Disc
DVD: Digital Versatile Disc
IoT: Internet of Things
HTTP: Hypertext Transfer Protocol
PIN: Personal Identification Number
PC: Personal Computer
NAV: Net Asset Value
AMC: Annual Maintenance Contract
CPU: Central Processing Unit
UPS: Uninterruptible Power Supply
Important Terms: Ethical and Social Issues
- Digital Divide: Unequal access to ICT resources, leading to disparities in education, employment, and social opportunities between different communities or countries.
- Online Harassment: Issues like cyberbullying, trolling, and other forms of online abuse that can harm individuals' mental and emotional well-being.
- Privacy Concerns: Challenges related to protecting personal information from being collected, misused, or shared without consent.
- Digital Addiction: Over-dependence on ICT tools and platforms, which can affect mental health, relationships, and productivity.
- Job Displacement: Automation and ICT innovations replacing traditional roles, leading to unemployment or the need for re-skilling in certain sectors.
Full Form: Ethical and Social Issues in ICT
Ethical and Social Issues in ICT
- IT: Information Technology
- ICT: Information and Communication Technology
- G2G: Government to Government
- E-commerce: Electronic Commerce
- ETA: Estimated Time of Arrival
Full forms: Computer Network and Telecommunication
Computer Network and Telecommunication
- ARPANET: Advanced Research Projects Agency Network
STP: Shielded Twisted Pair
UTP: Unshielded Twisted Pair
SMA: SubMiniature version A
SC: Subscriber Connector or Standard Connector
NIC: Network Interface Card
MODEM: Modulator-Demodulator
LAN: Local Area Network
MAN: Metropolitan Area Network
WAN: Wide Area Network
TCP/IP: Transmission Control Protocol/Internet Protocol
HTTP: Hypertext Transfer Protocol
SMTP: Simple Mail Transfer Protocol
WWW: World Wide Web
POP: Post Office Protocol
FTP: File Transfer Protocol
URL: Uniform Resource Locator
ISP: Internet Service Provider
ATM: Asynchronous Transfer Mode
E-mail: Electronic Mail
E-fax: Electronic Fax
E-commerce: Electronic Commerce
Thursday, March 20, 2025
VVI: C Programming questions solution
C Programming questions solution
1. Write C program to display first 10 natural numbers
(1 to 10)
Solution:
#include <stdio.h>
int main()
{
int i;
printf("Natural numbers from 1 to 10:\n");
for (i = 1;
i <= 10; i++)
printf("%d ", i);
printf("\n");
return 0;
}
2. Write a C programming to display first 20 natural numbers
(1 to 20)
Solution:
#include <stdio.h>
int main()
{
int i;
printf("Natural numbers from 1 to 20:\n");
for (i = 1;
i <= 20; i++)
printf("%d ", i);
printf("\n");
return 0;
}
3. Write a program to print natural numbers from 1 to
50.
Solution:
#include <stdio.h>
int main()
{
int i;
printf("Natural numbers from 1 to 50:\n");
for (i = 1;
i <= 50; i++)
printf("%d ", i);
printf("\n");
return 0;
}
4. Write a program using C language to display reverse
order from the entered number.
[ex: Enter 5 and display the result: 5 4 3 2 1)
Solution:
#include <stdio.h>
int main() {
int n, i;
printf("Enter the value of n: ");
scanf("%d", &n);
printf("Numbers in reverse order from %d to 1:\n", n);
for (i = n;
i >= 1; i--)
printf("%d ", i);
printf("\n");
return 0;
}
5. Write C program to get the output for natural
numbers from 5 to 15.
Solution:
#include <stdio.h>
int main()
{
int i;
printf("Natural numbers from 5 to 15:\n");
for (i = 5;
i <= 15; i++)
printf("%d ", i);
printf("\n");
return 0;
}
6. Write C programming to calculate the sum of first
10 natural numbers.
Solution:
#include <stdio.h>
int main()
{
int i, sum =
0;
for (i = 1;
i <= 10; i++)
sum +=
i;
printf("The sum of the first 10 natural numbers is: %d\n",
sum);
return 0;
}
7. Write C program to display only multiples of 5 from
1 to 50.
Solution:
#include <stdio.h>
int main()
{
int i;
printf("Multiples of 5 from 1 to 50:\n");
for (i = 1;
i <= 50; i++)
if (i %
5 == 0)
printf("%d ", i);
return 0;
}
8. Write C programming to display odd numbers from 1
to 19.
Solution:
#include <stdio.h>
int main()
{
int i;
printf("1 to 19 odd numbers:\n");
for (i = 1;
i <= 19; i += 2)
printf("%d ", i);
printf("\n");
return 0;
}
9. Write C programming to display first 15 odd
numbers.
Solution:
#include <stdio.h>
int main()
{
int i;
printf("First 15 even numbers:\n");
for (i = 2;
i <= 30; i += 2)
printf("%d ", i);
printf("\n");
return 0;
}
10. Write a C program to count and print all odd
numbers between 1 and 50.
Solution:
#include <stdio.h>
int main()
{
int i, sum =
0;
printf("Odd numbers between 1 and 50 are:\n");
for (i = 1;
i <= 50; i += 2)
{
printf("%d ", i);
sum
+= i;
}
printf("\nSum of odd numbers between 1 and 50: %d\n", sum);
return 0;
}
11. To display the reverse order of odd numbers from
19 to 1 write a programming using C language.
Solution:
#include <stdio.h>
int main()
{
int i;
printf("Odd numbers from 19 to 1:\n");
for (i = 19;
i >= 1; i -= 2)
printf("%d\n", i);
return 0;
}
12. Extend the program to calculate the sum of the
first 15 odd numbers.
Solution:
#include <stdio.h>
int main()
{
int i, sum =
0;
printf("Odd numbers between 1 and 15 are:\n");
for (i = 1;
i <= 15; i += 2)
{
printf("%d\n", i);
sum
+= i;
}
printf("\nSum of odd numbers between 1 and 15: %d\n", sum);
return 0;
}
13. Write C programming to print the first 15 odd
numbers with their squares.
Solution:
#include <stdio.h>
int main()
{
int i;
printf("Square of odd numbers between 1 and 15 are:\n");
for (i = 1;
i <= 15; i += 2)
printf("%d\n", i*i);
return 0;
}
OR
#include <stdio.h>
int main()
{
int i;
printf("Square of odd numbers between 1 and 15 are:\n");
for (i = 1;
i <= 15; i += 2)
printf("%d = %d\n",i,i*i);
return 0;
}
14. Write a Program to display even numbers from 1 to
20.
Solution:
#include <stdio.h>
int main()
{
int i;
printf("Even numbers from 1 to 20:\n");
for (i = 2;
i <= 20; i += 2)
printf("%d ", i);
return 0;
}
15. Write C programming to display the sum of the
first 15 even numbers.
Solution:
#include <stdio.h>
int main()
{
int i, sum =
0;
printf("Even numbers between 1 and 30 are:\n");
for (i = 2;
i <= 30; i += 2)
{
printf("%d ", i);
sum
+= i;
}
printf("\nSum of even numbers between 2 and 30: %d\n", sum);
return 0;
}
16. Write a C program to identify if a given number is
even or odd.
Solution:
#include <stdio.h>
int main()
{
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 2
== 0)
printf("%d is an even number.\n");
else
printf("%d is an odd number.\n");
return 0;
}
C Programming (Multiplication Table)
[Multiplication table in C]
1. Write C programming to display multiplication table of 6.
Solution:
#include <stdio.h>
int main()
{
int num=6, i;
printf("Enter a number: ");
printf("Multiplication Table for %d:\n", num);
for (i = 1; i <= 10; ++i)
printf("%d x %d = %d\n", num, i, num * i);
return 0;
}
2. Write C programming to display multiplication table of any number entered by the user.
Solution:
#include <stdio.h>
int main()
{
int num, i;
printf("Enter a number: ");
scanf("%d", &num);
printf("Multiplication Table for %d:\n", num);
for (i = 1; i <= 10; ++i)
printf("%d x %d = %d\n", num, i, num * i);
return 0;
}
Terminology of Structured Programming in C
Important terminologies:
- Structured Programming: A method of writing organized code using loops, functions, and control structures.
- Function: A block of code performing a specific task.
- Array: A collection of elements stored in consecutive memory locations.
- Loop (For/While): A control structure to repeat tasks.
- Algorithm: A step-by-step procedure to solve a problem.
Terminology of File handling
Important terminologies:
File: A collection of data stored permanently.
Read/Write: Operations to access or save data in a file.
Open/Close: Commands to start or end interaction with a file.
Append: Adding data to an existing file without overwriting it.
Record: A structured data entry in a file.
Terminology of Modular Programing
Important terminologies:
- Module: A separate piece of a program designed for a specific task.
- Procedure: A block of code performing a particular function in modular programming.
- Abstraction: Focusing on relevant aspects of code while hiding complex details.
- Reuse: Using modules in multiple programs to save time and effort.
- Encapsulation: Restricting access to certain parts of a program.
Terminology of Programming
Important terminologies:
- Variable: A storage location for data in a program.
- Loop: A command to repeat actions in a program.
- If-Else Statement: A structure for decision-making in programming.
- Function: A reusable block of code to perform a specific task.
- Debugging: Finding and fixing errors in code.
Terminology of DBMS
Important terminologies:
Database: A collection of organized data.
Table: A structure in a database with rows and columns for data.
Primary Key: A unique identifier for records in a table.
Query: A command to retrieve or manipulate data from a database.
Foreign Key: It is a connection that connects two tables by linking the field or the multiple fields from one table to the key fields or the primary key in another table.
Terminology of Number System
Important terminologies:
Binary: A number system using only 0 and 1, which computers use to process data.
Decimal: The standard number system, using digits 0–9.
Octal: A base-8 number system, using digits 0–7.
Hexadecimal: A base-16 number system, using digits 0–9 and letters A–F.
Conversion: Methods of changing numbers from one system to another.
Terminology of Computer Security
Important terminologies:
Artificial Intelligence (AI): Machines capable of performing tasks that require human intelligence.
Virtual Reality (VR): A simulated environment experienced through technology.
Robotics: The design and operation of robots.
Internet of Things (IoT): Devices connected to the internet to share data.
Blockchain: A system for storing information securely.
Terminology of E-Commerce
Important terminologies:
Payment Gateway: A service that processes online transactions securely.
Shopping Cart: A feature on e-commerce sites where customers save items they intend to buy.
Digital Wallet: An electronic method of storing payment details.
E-Commerce: Method of buying, selling and exchanging goods through electronic media.
M-Commerce: Mobile Commerce is a method of buying, selling and exchanging goods through handheld device like smartphone and tablets.
Terminology of Contemporary Technology
Important terminologies:
- Firewall: A security system that monitors and controls network traffic.
- Malware: Harmful software like viruses, worms, and trojans.
- Encryption: Converting data into a coded format to prevent unauthorized access.
- Phishing: Fraudulent attempts to obtain sensitive information by pretending to be a trustworthy source.
- Authentication: Verifying the identity of a user or system.
Terminology of Ethical and Social Issues
Important terminologies:
- Cyberbullying: Harassing someone online through messages or social media.
- Piracy: Unauthorized use or reproduction of software, music, or movies.
- Privacy: The right to control personal information and its use.
- Plagiarism: Using someone else's work without proper acknowledgment.
- Digital Divide: The gap between those with and without access to technology.
Terminology of Computer Network and Telecommunication
This section explores the basics of how computers connect and share information through networks. It includes concepts like the internet, LAN, and WAN, as well as the role of telecommunication in enabling global communication.
Important terminologies:
- LAN (Local Area Network): A network confined to a limited area, such as a school or office.
- WAN (Wide Area Network): A network spanning large geographic areas, connecting multiple LANs.
- IP Address: A unique identifier assigned to devices connected to a network.
- Router: A device that directs data between networks.
- Bandwidth: The amount of data that can be transmitted over a network in a given time.
- Packet Switching: A method of data transfer where information is divided into packets.
Computer Science Grade 10 Chapters
Grade 10 Chapters
Subject: Computer Science
Unit 1.1 Networking and Telecommunication
Unit 1.2 Ethical and Social Issues in ICT
Unit 1.3 Computer Security
Unit 1.4 E-commerce
Unit 1.5 Contemporary Technology
Unit 1.6 Number System
Unit 2.1 Database Management System
Unit 3.1 Programming in QBASIC
Unit 3.2 Modular Programming
Unit 3.3 File Handling in QBASIC
Unit 4.1 Structured Programing in C
०००
Monday, March 17, 2025
PRACTICE QUESTIONS: 'DEBUG'
PRACTICE QUESTIONS: 'DEBUG'
Re-write the following programs after correcting the bugs:
Question no. 1
CLS
OPEN "Marks.dat" FOR INPUT AS #1
DO WHILE EOF(1)
INPUT #2, Name$, Subject$, Marks
IF Marks > 80 THEN
PRINT Name$
LOOP
CLOSE
END
Question no. 2
CLS
OPEN "Student.dat" FOR INPUT #1
WHILE NOT EOF(1)
INPUT ROLL, NAME$, CLASS
PRINT ROLL, NAME, CLASS
LOOP
CLOSE #1
END
Question no. 3
CLS
DISPLAY "Staff.dat" FOR APPEND AS #1
INPUT "Enter name"; NAME$
INPUT "Enter post"; POST
PRINT #1, NAME$, POST$
CLOSE 1
END
Question no. 4
DECLARE SUB SQUARE(N)
CLS
INPUT "Enter a number"; N
CALL SQUARE(N)
END
SUB SQUARE(N)
SQR = N x N
PRINT "Square is"; SQR
END
Question no. 5
DECLARE SUB FACTORIAL(N)
CLS
INPUT "Enter a number"; N
CALL FACTORIAL(A)
END
SUB FACTORIAL(N)
F = 1
FOR I = 1 TO N
F = F x n
NEXT
PRINT "Factorial is"; F
END
Question no. 6
DECLARE FUNCTION SQUARE(N)
DECLARE SUB SQUAREROOT(N)
CLS
INPUT "Enter a number"; N
PRINT "Square is"; SQUARE(N)
CALL SQUAREROOT(N)
FUNCTION SQUARE(N)
SQUARE = N * 2
END FUNCTION
SUB SQUAREROOT(N)
PRINT "Square root is"; SQUARE(N)
END SUB
Question no. 7
DECLARE SUB SI(P, R, T)
CLS
REM "Enter Principal, Rate, and Time"; P, R, T
CALL SUB SI(P, R, T)
END
SUB SI(P, R, T)
SIMPLEINTEREST = (P * R * T) ÷ 100
PRINT "Simple Interest is"; SIMPLEINTEREST
END
Questions no. 8
REMARK to display Employee Records
OPEN "Employee.dat" FOR OUTPUT AS #1
WHILE NOT EOF(1)
INPUT #1, ID, NAME$, SALARY$
PRINT ID, NAME$, SALARY
LOOP
CLOSE #1
END
Question no. 9
OPEN "Employee.dat" FOR APPEND AS #1
DO WHILE NOT EOF(1)
INPUT #1, ID, NAME$, SAL
PRINT "ID:"; ID; "Name:"; NAME$; "Salary:"; SALARY
WEND
CLOSE #2
STOP
Question no. 10
REM to write Student Marks to a File
OPEN "Marks.dat" FOR INPUT AS #1
INPUT "Enter name": NAME$
INPUT "Enter marks"; MARKS
WRITE NAME$, MARKS
CLOSE 1
END
Question no. 11
REM Calculate Factorial
DECLARE SUB FACTORIAL(N)
CLS
READ "Enter a number"; N
CALL FACTORIAL(N)
END
SUB FACTORIAL(N)
F = 1
FOR I = 1 TO N
F = F * 1
NEXT I
PRINT "Factorial is"; F
FACTORIAL=F
END
Question no. 12
REM Display Even Numbers Between 1 to 20
DECLARE SUB EVEN NUMBERS()
CLS
CALL EVEN_NUMBERS
END
SUB EVEN_NUMBERS()
FOR I = 1 TO 20
IF I MOD 0 = 2 THEN PRINT I
NEXT
END
Question no. 13
REM Calculate Cube of a Number
DECLARE FUNCTION CUBE(N)
CLS
INPUT "Enter a number"; N
R=CUBE
PRINT "Cube is"; CUBE(R)
END
FUNCTION CUBE(N)
CUBE = N * 3
END
Question no. 14
REM Calculate Area of a Circle
DECLARE FUNCTION AREA(R)
CLS
INPUT "Enter radius"; Radius
PRINT "Area of circle is"; AREA(R)
END
FUNCTION AREA(R)
ARE = 3.14 * R * 2
FUNCTION
Question no. 15
REM Calculate Square and Square Root
DECLARE FUNCTION SQUARE(N)
DECLARE SUB SQUAREROOT(N)
CLS
INPUT "Enter a number"; N
PRINT "Square is"; SQR(N)
CALL SQUAREROOT(N)
END
FUNCTION SQUARE(N)
SQR = N * 2
END FUNCTION
SUB SQUAREROOT
PRINT "Square root is"; SQR(N)
END SUB
Question no. 16:
REM Calculate Simple Interest Using Sub Procedure
DECLARE SUB SI(P, R, T)
CLS
INPUT "Enter Principal, Rate, and Time"; P, R, T
SI(P, R, T)
END
SUB SI(P, R, T)
SIMPLEINTEREST = (P * R * T) / 100
PRINT "Simple Interest is"; SI
END
'COMBINED' Modular programming solutions
Modular programming solutions
1. Program to calculate
perimeter and area of a rectangle. Use sub procedure to calculate perimeter and
function procedure to calculate area.
DECLARE SUB PERI (L,
B)
DECLARE FUNCTION
AREA (L, B)
CLS
INPUT "Enter
length and breadth="; L, B
CALL PERI (L, B)
A = AREA (L, B)
PRINT "Area
of the rectangle="; A
END
SUB PERI (L, B)
P = 2 * (L + B)
PRINT
"Perimeter of the rectangle="; P
END SUB
FUNCTION AREA (L,
B)
AREA = L * B
END FUNCTION
2. Calculate
Simple Interest (Sub) and Compound Interest (Function)
DECLARE SUB SI (P,
R, T)
DECLARE FUNCTION
CI (P, R, T)
CLS
INPUT "Enter
Principal, Rate, and Time="; P, R, T
CALL SI (P, R,
T)
C = CI (P, R,
T)
PRINT
"Compound Interest="; C
END
SUB SI (P, R, T)
SI = (P * R * T)
/ 100
PRINT
"Simple Interest="; SI
END SUB
FUNCTION CI (P,
R, T)
CI = P * (1 + R
/ 100) ^ T - P
END FUNCTION
3. Calculate Area (Sub)
and Circumference (Function) of a Circle
DECLARE SUB
AREA(R)
DECLARE
FUNCTION CIRCUM(R)
CLS
INPUT
"Enter Radius of Circle="; R
CALL AREA (R)
C = CIRCUM (R)
PRINT
"Circumference of the circle="; C
END
SUB AREA (R)
A = 3.1416 * R
* R
PRINT
"Area of the circle="; A
END SUB
FUNCTION
CIRCUM(R)
CIRCUM = 2 *
3.1416 * R
END FUNCTION
4. Calculate Fahrenheit
(Sub) and Kelvin (Function) from Celsius
DECLARE SUB
FAHRENHEIT(C)
DECLARE
FUNCTION KELVIN(C)
CLS
INPUT "Enter
Temperature in Celsius="; C
CALL
FAHRENHEIT(C)
K =
KELVIN(C)
PRINT
"Temperature in Kelvin="; K
END
SUB
FAHRENHEIT(C)
F = (C * 9 / 5)
+ 32
PRINT
"Temperature in Fahrenheit="; F
END SUB
FUNCTION
KELVIN(C)
KELVIN = C +
273.15
END FUNCTION
5. Calculate Square Root
(Sub) and Cube Root (Function)
DECLARE SUB
SQRT_NUM(N)
DECLARE FUNCTION
CUBE_ROOT(N)
CLS
INPUT "Enter
a Number="; N
CALL
SQRT_NUM(N)
C =
CUBE_ROOT(N)
PRINT "Cube
Root="; C
END
SUB SQRT_NUM(N)
S = SQR(N)
PRINT
"Square Root="; S
END SUB
FUNCTION
CUBE_ROOT(N)
CUBE_ROOT = N ^
(1 / 3)
END FUNCTION
6. Calculate Square Root
(Sub) and Cube Root (Function)
DECLARE SUB
SMALL(A, B)
DECLARE FUNCTION
LARGE(A, B)
CLS
INPUT "Enter
two numbers: "; A, B
CALL SMALL(A,
B)
G = LARGE(A,
B)
PRINT
"Greater number="; G
END
SUB SMALL(A, B)
IF A < B THEN
PRINT "Smaller number="; A
ELSE
PRINT "Smaller number="; B
END IF
END SUB
FUNCTION LARGE(A,
B)
IF A > B THEN
LARGE = A
ELSE
LARGE = B
END IF
END FUNCTION
7. Calculate multiply(Sub) and addition (Function)
DECLARE FUNCTION Add(a, b)
DECLARE SUB Mul(a,b)
s = Add(a,b)
PRINT "Enter two
numbers:"; s
CALL Mul(r)
FUNCTION Add(a, b)
Ans = a + b
Ad=Ans
END FUNCTION
SUB Mul(a,b)
M=a*b
PRINT "The multiplication is
"; M
END SUB
8. SUB PROCEDURE TO DISPLAY 2, 4, 5, 8, 10.
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
9. SUB PROGRAM TO CALCULATE AREA AND FUNCTION PROGRAM TO CALCULATE VOLUME OF A ROOM.
DECLARE SUB
ARE(L, B)
DECLARE
FUNCTION VOL(L, B, H)
CLS
INPUT
"Enter length, breadth and height="; L, B, H
CALL ARE(L, B)
Vo = VOL(L, B,
H)
PRINT
"Volume="; Vo
END
SUB ARE(L, B)
AR = L * B
PRINT
"Area of a room="; AR
END SUB
FUNCTION VOL(L,
B, H)
VOL = L * B * H
END FUNCTION
Map of Nepal
नेपालको नक्सा: नेपालको नक्सा: नेपालको नक्सा: नेपालको नक्सा: नेपालको नक्सा: नेपालको नक्सा: नेपालको नक्सा:

Most viewed!
-
Modular programming solutions 1. Program to calculate perimeter and area of a rectangle. Use sub procedure to calculate perimeter and funct...
-
PRACTICE QUESTIONS: 'DEBUG' Re-write the following programs after correcting the bugs: Question no. 1 CLS OPEN "Marks.dat...
-
VERY SHORT ANSWER (KEYWORDS ONLY): Programming: QBASIC, Modular programming, File Handling, C programming 1. What is QBASIC? Begi...
-
Computer Programming/Modular Programming/File Handling Modular Programming: Process of writing program in multiple modules Main Module: The...
-
VERY SHORT ANSWER: Chapter Networking and Telecommunication 1. What is a computer network? Interconnected computers 2. What is LA...