Important Questions for Board Exam
1. What are the stages involved while solving a problem using computer? Show
the steps in figure.
2. Write an algorithm to check whether the given number is prime or
composite.
3. Write an algorithm to find the factorial of a given number.
4. Write an algorithm and draw flowchart to find the largest number among
three numbers.
5. Write an algorithm and draw flowchart to determine whether a given integer
is odd or even.
6. Write an algorithm and draw a flowchart that prints the sum of first 10
natural numbers.
7. Why flowchart is required? Explain different symbols used in the flowchart.
8. What do you understand by the term’s compilation and execution.
9. What do you mean by debugging and testing? How these two terms differ in
meaning?
10.Why should we document a program? Explain.
11.Explain the structure of C-program in detail.
12.What do you mean by statement? Explain the different types of statement
with example.
[email protected] 1
13.How can you declare the variable in C? Explain with example.
14.What are the basic four data types used in C programming? What are its
size and range? Explain with example.
15.Determine which of the following are valid identifiers? If invalid, explain
why?
a. record1
b. record
c. file_3
d. return
e. #tax
f. name
g. goto
h. name and address
i. 123-45-6789
j. Void
k. name_address
16.Find the value of “𝑎” in each of the following statements:
𝑖𝑛𝑡 𝑖 = 2, 𝑗 = 5, 𝑘 = 7; 𝑓𝑙𝑜𝑎𝑡 𝑎 = 1.5, 𝑏 = 2.5, 𝑐 = 3.5;
a. 𝑎 = 𝑐 − 𝑖/𝑗 + 𝑐/𝑘;
b. 𝑎 = (𝑐 − 𝑖)/𝑘 + (𝑗 + 𝑏)/𝑗
c. 𝑎 = 𝑏 ∗ 𝑏 − ((𝑖 + 𝑗)/𝑐);
d. 𝑎 = 𝑏 − 𝑘 + 𝑗/𝑘 + 𝑖 ∗ 𝑐;
e. 𝑎 = 𝑐 + 𝑘%2 + 𝑏;
f. 𝑎 = (𝑏 + 4)%(𝑐 + 2);
17.Define 𝑝𝑟𝑖𝑛𝑡𝑓() function, header file, and main function. Find the value of
following expression. Use the initially assigned to the variables for each
expression.
𝑖𝑛𝑡 𝑎 = 8, 𝑏 = 5; 𝑓𝑙𝑜𝑎𝑡 𝑥 = 0.005, 𝑦 = −0.01;
a. 2 ∗ ((𝑎/5) + 4 ∗ (𝑏 − 3))%(𝑎 + 𝑏 − 2));
b. (𝑥 > 𝑦)&&(𝑎 > 0)||(𝑏 < 5);
[email protected] 2
c. (𝑎 > 𝑏)? 𝑎: 𝑏;
18.Find the error in the given program and explain it. Write the correct
program.
#include<stdio.h>
#include<math.h>
main
{
float p, r, n;
printf("Please enter a value for the principle (P):");
scanf("%f", &p);
printf("Please enter a value for the interest rate (R):");
scanf("%f", &r);
printf("Please enter a value for the number of years (n):");
scanf("%f", n);
I = p * n * r / 100;
printf(\nThe final value (I) is %f, i);
19.What are the three types of input/output functions which support in C
programming? Explain with example.
20.What are the different types of operators available in C? Explain.
21.Discuss different logical operators along with the truth table.
22.What is operator? List any six operators used in C programming language.
Write a program to find least number between any two user input numbers
using ternary operator.
23.Explain the relational operator with example.
24.Explain the increment/decrement operator with example.
25.Discuss different bitwise operators in detail.
[email protected] 3
26.What is looping statement? Discuss different looping statements with
suitable example of each.
27.Discuss different types of if statements with example of each. Differentiate if
statement with switch statement.
28.What do you mean by entry-controlled and exit-controlled loop? Write a
program to print the following output.
1
01
101
0101
10101
29.Explain the “if … else” statement with an example.
30.What are the four types of control statements used in C programming?
Explain.
31.Differentiate between while and do while loop with an example.
32.Differentiate break statement with continue statement. What is the output of
the following program?
33.Explain switch statement with an example.
34.Write a program that uses a “for” loop to compute and print the sum of a
given numbers of squares. For example, if 4 is input, then the program will
print 30, which is equal to 12 + 22 + 32 + 42 .
35.Write a program that uses a “while” loop to compute and prints the sum of
a given numbers of squares. For example, if 4 is input, then the program will
print 30, which is equal to 12 + 22 + 32 + 42 .
[email protected] 4
36.Write a program that uses a “do … while” loop to compute and print the
sum of a given numbers of squares. For example, if 4 is input, then the
program will print 30, which is equal to 12 + 22 + 32 + 42 .
37.Differentiate between break and exit statement with an example.
38.Write a program to read the marks of four subjects then find total,
percentage, and division according to given condition.
Percentage Division
𝑝 ≥ 80 Distinction
80 > 𝑝 ≥ 70 First Division
70 > 𝑝 ≥ 50 Second Division
50 > 𝑝 ≥ 40 Third Division
Otherwise Fail
Assume each subjects carrying 100 full marks and students must secure
greater or equal to 40 in each subjects for division.
39.Write a program to display following output.
1
11
111
1111
11111
40.Write a program to check whether a number entered is even or odd.
41.What is the output of the following program?
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int x=2,n=5,sum=0,i;
for(i=1;i<=n;i++)
[email protected] 5
{
if(i%2==0)
sum=sum-pow(x,i);
else
sum=sum+pow(x,1);
}
printf("sum=%d",sum);
getch();
}
42.Define array. What are the benefits of using array? Write a program to add
two matrices using array.
43.Write a program to check whether the diagonal elements of a 4𝑋4 matrix
are all zero.
44.Write a program to find the largest and smallest among the given elements
in an array.
45.Write a program to obtain the product of the following matrices and explain
it.
3 5 7 7 6
𝐴 = [2 −3 4] , 𝐵 = [6 −5]
4 5 2 4 3
46.Write a program to transpose the following matrix.
−3 7 5 −2 8
[ 2 5 8 3 −4]
−6 9 3 6 5
47.Write a program to enter two 3𝑋3 matrices and calculate the product of
given matrices.
[email protected] 6
48.Explain multidimensional array with example. Write a program to convert a
lowercase character string into uppercase.
49.Write a program to find the sum of each row of 3𝑋2 matrix.
50.Write a function to multiply two matrices.
51.Explain the use of two dimensional arrays. Illustrate it with suitable
program and explain it.
52.Write a program to add two 3𝑋3 matrix using functions.
53.Explain the functions and its types used in C programming with examples.
54.Explain pass by value and pass by reference with suitable example of each.
55.Explain the user-defined functions and its types with example.
56.Write a function to add, subtract, multiply, and divide two complex
numbers (𝑥 + 𝑖𝑦)& (𝑐 + 𝑖𝑑).
57.Explain library functions with example.
58.Write and test the following 𝑝𝑜𝑤𝑒𝑟( ) function that returns 𝑥 raised to the
power 𝑛, where 𝑛 can be any integer:
𝑑𝑜𝑢𝑏𝑙𝑒 𝑝𝑜𝑤𝑒𝑟 (𝑑𝑜𝑢𝑏𝑙𝑒 𝑥, 𝑖𝑛𝑡 𝑝)
59.Differentiate between call by value and call by reference with example.
60.What is recursion? Write a program to find the factorial of given number
using recursion.
61.What is function? Discuss the benefits of using function.
[email protected] 7
62.Discuss any five string library functions.
63.Write a program to accept any number and print the sum of that number up
to a single digit through recursive function.
64.What is structure? How is it different from an array? Create a structure
student having data members name, roll-number and percentage. Complete
the program to display the name of student having percentage greater than
or equal to 60.
65.Explain the passing of structure to a function with an example.
66.How is structure different than union. Discuss in detail.
67.Define a structure of student having data members, name, address, marks in
C language, and marks in information system. Take data for n students in an
array and find the total marks obtained.
68.Define a structure of employee having data members name, address, age,
and salary. Take data for employee in an array and find the average salary.
69.Why structure is required? Make a program using structure of booklist
having data member’s title, author, and cost. Enter four data and calculate
the total cost.
70.Explain the array of structures and write a program to accept record of 15
persons which has name, age, and address and also display them.
71.Create a structure rectangle with data members length and breadth.
Calculate area of the rectangle.
72.What is the function of a pointer variable? Explain the declaring and
initializing of pointers with example.
[email protected] 8
73.Write a program using pointers to read in an array of integers and print its
elements in reverse order.
74.Write a program to find sum and average of n numbers entered from the
keyboard using dynamic memory allocation to create an array to store these
n numbers.
75.Write a program to accept two numbers and sort them using pointer.
76.Write a program to find the sum of all the elements of an array using
pointers.
77.Write a program to accept 10 numbers and show them using pointer.
78.Why pointer is called jewel of C language? Write a program that uses
pointer to copy an array of integers.
79.Write a function that passes an array of pointers to floats and returns a
newly created array that contains those n float values.
80.What is a pointer? Explain its applications. Write a program that uses
pointers to copy an array of double.
81.Explain pointer with suitable diagram and its use in C programming.
82.Write a function that uses pointers to search for the address of a given
integer in a given array. If the given integer is found, the function returns its
address; otherwise it returns NULL.
83.Explain pointer arithmetic with an example.
84.Explain pointer to structure with an example.
[email protected] 9
85. What is Dynamic Memory Allocation (DMA)? Discuss the following
functions.
a. malloc( )
b. calloc( )
c. realloc( )
d. free( )
86.Why do we need data files? What are the different file opening modes? Write
a program that reads data from a file “input.txt” and writes to “output.txt”
file.
87.Write a program which will read a line and delete from it all occurrences of
the word “that”.
88.Discuss different file opening modes. Write a program to read all the
numbers from the input file “value.dat” and store only even numbers in an
output file named as “result.res”.
89.Write a program to read the data file which has following details.
a. Name
b. Age
c. Test player
d. Total run
90.Some text file is given; create another text file replacing the following
words: “Ram” to “Hari”, “Sita” to “Gita”, and “Govinda” to “Shiva”.
91.What are the uses of graphical function? Explain the basic graphical
function with suitable program.
92.Given a text file, create another text file deleting the following words:
“three”, “bad”, and “time”.
[email protected] 10
93.Why do you require graphical function? Explain the basic graphical
function with suitable program.
94.Write a program to create a file “RECORD.TXT” then store roll no, name,
and percentage of 10 students.
95.Write a program to read and print data stored in a file input.txt.
96.Discuss with example any five graphics function used in C-Programming.
97.List any five names of graphics function. Write a program to read line of text
then count number of vowels, number of digits, and number of spaces.
98.Define the graphics function. Why do we need graphic functions? Write a
program to draw a circle using graphics function.
99.Explain the use of graphical function. Make a program that contains basic
graphic functions.
[email protected] 11