Important Questions of PPS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Important Questions Programming for Problem solving (BCS101)

Short answer questions

1. How to declare and initialize 1-D, 2-D array with an example.


2. Differentiate between Linear search and Binary Search.
3. What is the difference between structure and union?
4. How the size of the structure defined in c programming?
5. What is enumerated data type?
6. Differentiate between structure and union in 'C'. Write a 'C' program to store the employee
details using structure.
7. Explain the significance of null character in string
8. Differentiate between structure and array
9. Discuss break and continue statement with help of an example.
10. Discuss go to statement.
11. Differentiate between entry control loop and exit control loop.
12. What will happen if we assigned a value to an array element whose size of subscript is
greater than the size of array in C programming?
13. What is the output of C program.?
void main()
{
float marks[3] = {90.5, 92.5, 96.5};
int a=0;
while(a<3)
{
printf("%.2f,", marks[a]);
a++;
}
}
14. What is the output of C Program.?
int main()
{
while(true)
{
printf("RABBIT");
break;
}

return 0;
}

15. What will be output of the following C code.


#include <stdio.h>
int main()
{
int i;
for(i=65; i<(65+26);i++)
printf("%c ",i);
return 0;
}

Long answer questions


1. Write a program in C to print the sum and average of elements of given array.
2. Write a program in C to input two one dimensional array and print their sum in third array.
3. Write an algorithm of Binary Search and explain with the help of an example.
4. Write a program in C to implement Binary Search.
5. What is searching? Write a program to implement linear search.
6. Write a program to copy the contents of one array into another in the reverse order.
7. Write a program to add two matrices. of dimension (read size and number of element of
matrices from the keyboard).
8. Write a program to multiply two matrices (read size and number of element of matrices
from the keyboard).
9. Write a program in C to find the largest and smallest number of elements in 4*4 matrix.
10. Write a C program to print transpose of matrix and check whether a given square matrix
is symmetric or not.
11. Write a C program to find sum of diagonal and opposite diagonal element.
12. Write a C program to print lower and upper triangular matrix pattern from given array.
13. Write an algorithm to find second largest element in an array.
14. Write a program two find out the odd place and even place numbers from the array elements
and print the sum of these numbers respectively.
15. Write a program to print the Fibonacci series upto nth term.
16. Write an algorithm and draw a flowchart to find the sum of digits of an integer number entered
by the user.
17. Write an algorithm and draw a flowchart to reverse an integer number entered by the user
18. Write a program to find the Armstrong number from 1 to 100
19. Write a C program to add first seven terms of the following series using for loop. 1/1 +2/2 +3/3
20.
Write a C program to add first seven terms of the following series using for loop. 1/11 +2/22
+3/33

21. Any integer number is entered through the keyboard. Write a program to obtain the reversed
number and determine whether the number is palindrome or not.
22. Write a program to check whether a given number is Armstrong or not.
23. Write a program in 'C' to find that the given number is prime or not.
24. Write a program in 'C' to print all prime between and lower and upper limit .
25. Write a program to find the factorial of any integer entered by the user.
26. Write a Program in C to print the table of any integer number input by the user . and print the
output like .
12*1 = 12
12*2 = 24
.
.
.
12*10 = 120
27. Write a program in C to print the following pattern.
A
BC
DEF
GHIJ
28. Write a program in C to print the following pattern.

*
** *
*****
29. Write a program in C to print the following pattern.
5
45
345
2345
12345
30. Write a program in C to print the following pattern.
5
54
543
5432
54321

31. Explain the importance of structure in C programming. Write a program in C using structure to
enter and print the record of 10 books available in your library. Following fields may be included
in the record: - book_title, book_price and number_of_pages.
32. Write a program in C to create a database of fifty students to store personal details such as roll
no, name and marks. Print all the details of student whose roll no entered by user
33. Write a program in C to reverse a string without using string function.
34. What is string? Also explain the following string functions
i. Strcpy()
ii. Strrev()
iii. Strlen()
iv. Strcmp()
35. Define structure with syntax .Also write a program that compares two given dates. To store date
use structure say date that contains three members namely date, month and year. If the dates
are equal then display message as "Equal" otherwise "Unequal".
36. Write a program to count the number of characters, spaces and words new lines in a string .
37. Differentiate between structure and union in 'C'. Write a 'C' program to store the employee
details using structure
38. Create a suitable structure in C language for keeping the records of employees of an
organization about their name, code, designation, salary, department, city of posting. Also write
a c program to enter the records of 100 employees and display the names of those who earn
more than 20,000.
39. Write a C program that accepts a string and checks whether a given string is a
palindrome or not.
40. Write a C program to find the length of a string without using the built-in function.
41. Write a program to print the pattern

1
12
123
1234
123
12
1

You might also like