Programming Questions Set for Grade: X
Modular Programming Questions
1. Write a program in QBASIC that
asks three numbers and calculate
its average and product. Create a user-defined function to calculate average
and sub program to calculate product.
2. Write a program in QBASIC that
asks two numbers and calculate
its difference and remainder. Create a user-defined function to calculate difference
and sub program to calculate remainder.
3. Write a program in QBASIC that
asks a number and calculate
its cube and cube root. Create a user-defined function to calculate cube and
sub program to calculate cube root.
4. Write a program in QBASIC that
asks two numbers and calculate sum and difference of its cube. Create a
user-defined function to calculate sum and sub program to calculate difference.
5. Write a program in QBASIC that
asks cost and selling price and calculate the profit and loss. Create a
user-defined function to calculate profit and sub program to calculate loss.
6. Write a program in QBASIC that
asks the length and calculate
its area and perimeter of a square. Create a user-defined function to calculate
area and sub program to calculate perimeter.
7. Write a program in QBASIC that
asks radius of a circle and calculate
the area and circumference. Create a user-defined function to calculate area
and sub program to calculate circumference.
8. Write a program in QBASIC that
asks amount in NRS and convert it in INRs and USD. Create a user-defined
function to convert in INRs and sub program to convert in USD.
9. Write a program in QBASIC that
asks length in feet and convert in inches and centimeters. Create a
user-defined function to convert in inches and sub program to convert
centimeter.
10. Write a program in QBASIC that
asks a number and display whether divisible by 3 and 7. Create a user-defined
function to check whether it is divisible by 3 and sub program to check whether
it is divisible by 7.
11. Write a program in QBASIC that
asks a number and check whether it is perfect square and perfect cube. Create a
user-defined function to check whether it is perfect square and sub program to check
whether it is perfect cube.
12. Write a program in QBASIC that
asks a number and check whether it is odd or even and negative, positive or
zero. Create a user-defined function to check whether it is odd or even and sub
program to check negative, positive or zero.
13. Write a program in QBASIC that
asks for a multidigit number and display it in reverse and checks that it is
palindrome or not. Create a user-defined function to display its reverse and
sub program to check palindrome or not.
14. Write a program in QBASIC that
asks the age of a person and checks whether s/he can vote and drive. Create a
user-defined function to check whether s/he can vote and sub program to s/he
can drive.
15. Write a program in QBASIC that
asks three numbers and display the greatest and smallest number. Create a
user-defined function to display greatest and sub program to display smallest.
16. Write a program in QBASIC that
asks a multidigit numbers and check whether it is palindrome or not and Armstrong
or not. Create a user-defined function to check palindrome and sub program to check
Armstrong.
17. Write a program in QBASIC that calculates
the sum of even numbers and odd numbers between 1 to 20. Create a user-defined
function to calculate sum of even numbers and sub program to calculate sum of
odd numbers.
18. Write a program in QBASIC that
asks a number and check whether it is prime or composite and factorial. Create
a user-defined function to check prime or composite and sub program to display factorial.
19. Write a program in QBASIC display
the following series: 1, 11, 111, 1111, 11111 and 55555, 5555, 555, 55, 5.
Create a user-defined function to display the first series and sub program to display
the second series.
20. Write a program in QBASIC display
the following series: 1, 4, 9, up to 10th term and 1, 8, 27, up to
10th term. Create a user-defined function to display the first
series and sub program to display the second series.
21. Write a program in QBASIC that asks
for a word and display its reverse and check whether it is palindrome or not.
Create a user-defined function to check whether it is palindrome or not and sub
program to display its reverse.
22. Write a program in QBASIC that
asks for a sentence and displays the total number of consonants and vowels.
Create a user-defined function to count the consonants and sub program to count
the vowels.
23. Write a program in QBASIC that
asks for three different words and check the longest word and shortest word
supplied. Create a user-defined function to check longest and sub program to
display shortest.
24. Write a program in QBASIC that
asks for a word and displays a new word after removing vowel and consonant.
Create a user-defined function to display a new word after removing vowel
letters and sub program to display a new word after removing consonant letters.
25. Write a program in QBASIC that
asks for a sentence and displays the initial letters of each words and last
letters of each words. Create a user-defined function to display initial
letters and sub program to display last letters.
File Handling Programming Questions
1. Write a
program to store Roll no., Name, Class, and Address of any five students in a
sequential data file named “strec.txt”.
2. A sequential
data file called “student.dat” contains same records under the field’s name,
English, Nepali and Computer. Write a program to add some more records in the
same sequential data file.
3. A sequential
data file “RECORD.DAT” and store Name, Address and Salary of employees. WAP to
add some more records in the data file “RECODR.DAT”. Program should terminate
with user choice.
4. Create a
data file to store the records of a few employees having Name, Address, Post,
Gender, and Salary fields.
5. Create a
sequential data file “Price.dat” to store item name, quantity and Rate also
calculate total amount (total=Quantity X Rate). Program should terminate
according to the user’s choice.
6. Create a
sequential data file “post.dat” to store name and marks of any three subjects
also calculate total and percentages only for 15 students.
7. A sequential
data file “Address.inf” contains serial no, name, address, telephone, and email
id. WAP to record as many records as the user wants. The serial number should
be generated automatically like 5001, 5003, 5005.
8. A Sequential
data file called "SEE.DAT" has stored data under the field heading
Symbol No., Name, English, Nepali, and Computer. Write a program to display all
the information of those students whose mark in Computer is more than 80.
9. A sequential
data file “STD.TXT” contains the name and marks in three different subjects of
some students. Write a program to display only fail student’s records assuming
pass marks 40.
10. Write a
program which reads records from the file “Result.DAT” having the fields name,
and marks of three different subjects and display only those records whose
percentage is greater than 60 and less than 80. Also count the total number of
records presenting in that data files.
11. Write a
program to read all the records from the data file “STUDENT.TXT” and display
all the records where the fields name is unknown.
12. A data file
"pabson.txt" contains the records composed of the fields like school,
principal, address, contact. Write a program in QBasic to display records of
the schools located in either Kathmandu or Palpa.
13. A data file
“INFO.DAT” has numerous records in it with name, address age, and telephone
numbers in it. Write a program to read all the records and print those with address
“NEPAL” and age >15.
14. A sequential
data file “SALARY.DAT” contains the information, Employee-Code, Employee-Name,
Post, Basic Salary. Write a program to display those records whose Basic salary
is between 10000 to 15000 and Post is ‘OFFICER’.
15. A sequential
data file “emp.dat” contains name, post, and salary fields of information about
employees. Write a program to display all the information of employees along
with tax amount (also tax is 15% of salary).
16. A sequential
data file’post.dat’ has few records related to name, address, salary. WAP to
display the records whose address begins with ‘S’ or ‘D’.
17. Write a
QBasic program that reads the "EMP.DAT" file with Name, Address, Post
and Salary columns from E: drive that has 500 records of employees and displays
only its last 50 records.
18. Write a
program to display the first 10 records from a file named “resource.dat” having
fields name, phone, and email.
19. A data file
named “record.dat” contains name, age, and salary for n number of people. Write
a program to input a name to search data from a data file. If the data is not
found, then display the message “Data not found in the list”.
20. Delete some
records from “neps.dat” file where computer ask user to enter the record, which
is to be deleted. (Fields are name, address, and telephone number)
C Programming Questions
1. Write a
c-program that asks a number and checks whether it is negative, positive or
zero.
2. write a
program in c-language to display the first 10 odd numbers.
3. Write a C
program to check if the entered number is odd, even or anything else.
4. Write a C
program to check the middle number among three numbers entered by the user.
5. Write a C
program to check whether the entered number is prime or composite.
6. Write C
program to display the smallest number among any three numbers given by the
user.
7. Write a C
program to display all the even numbers from 1 to 100.
8. Write C
program to display the series: 2 8 18 32 ……… up to 10th terms.
9. Write a C
program to check if the supplied number is palindrome or not.
10. Write C
program to display the series 1, 2, 3, 5, 8 …….. up to 10th term.
11. Write a C
program that reads the principle, rate of interest and number of years and
finds the simple interest and amount.
12. Write a C
program to read the radius of a circle and display its area.
13. Write a C
program to convert a temperature reading in degree Fahrenheit (feh) to degree
Celsius (Cel) using the formula: C = (5/9) (F-32)
14. Write a C
program to enter any multidigit number and find sum of its individual digits.
15. Write a
program to print the numbers from I to 100 using while loop in C language.
16. Write a
program in C language to input a number then check whether the number is
divisible by 5 and 7 or not.
17. Write a
program in C language to input a number then check whether the number is perfect
square or not.
18. Write a
program to input percentage and check whether he/she secure distinction, first
division, second division, third division or fail. [Note: >=80 distinction,
>=70 first division, >=50 second, >=35 third, below 35 fail]
19. Write a C
program to display the reverse of input number.
20. Write a C
program to input three different and find the average of the supplied three
numbers.