Question Bank FP-2
Question Bank FP-2
break statement terminates the loop and takes the program control to the statement
immediately following the loop.
An array is a fixed-size sequenced collection part of elements of the same data type.
a) 66 b) -1 c) 1 d) 65
a) Self Function
b) Auto Function
c) Recursive Function
d) Static Function
#include<stdio.h>
int func(int m)
int s=0,i;
for(i=0;i<=m;i++)
s+=i;
return s;
int main()
int a = 5,b;
b=func(a);
printf("%d",b);
return 0;
a) 5 b) 15 c) 20 d) None of these
13. Structures contain heterogeneous data types. [ T/F] Tick the correct one.
14. What is the output of the following block:
#include <stdio.h>
void solve() {
int ch = 2;
switch(ch) {
case 1: printf("1 ");
case 2: printf("2 ");
case 3: printf("3 ");
default: printf("None");
}
}
int main() {
solve();
return 0;
}
a. 1 2 3 None
b. 2 3 None
c. 2
d. None
15. Which of the following are correct file opening modes in C?
a. r
b. w
c. rw
d. All of the above
#include<stdio.h>
int func(int m)
if(m == 1)
return 1;
else
return 2+func(m-1);
int main()
int a = 4, b;
b=func(a);
printf("%d",b);
return 0;
a) 3 b) 4 c) 7 d) 8
#include<stdio.h>
int main()
int a = 10;
int *p;
p=&a;
printf("%d",*p+8);
return 0;
a. Forever
b. Never
c. 0
d. 1
22. Let p1 and p2 be integer pointers. Which one is a syntactically wrong statement?
a. p1 + p2;
b. p1-9;
c. p1+9;
d. p1-p2;
#include<stdio.h>
int main()
{
int a[4] = {10,8,12,23};
int *p;
p=&a[0];
printf("%d %d",*(p+2),*(p+3));
return 0;
a) 10 8 b) 8 12 c) 12 23 d) 12 12
24. How is the 3rd element in an array accessed based on pointer notation?
a. *a+3
b. *(a+3)
c. *(*a+3)
d. &(a+3)
25. FILE *fp; ftell(fp) will give the ………………position of the file. Fill in the blanks.
26. int main (int argc, char *argv []) is the syntax to represent …………………Fill in the blanks.
27. What is the if…..else statement?
28. What is the relationship of algorithm with program?
29. Draw a flowchart to reverse of an inputted number.
30. Draw a flowchart to compute highest common factor between two inputted positive numbers.
31. What are looping instructions in C?
32. Explain break and continue statements.
33. Define a string with an example.
34. Write an algorithm to find the sum of n numbers where n is input by user.
35. Write a C program taking a function that will calculate multiplication of three integers.
36. Write a C program to read from a text file.
37. What is a structure?
38. Differentiate between array and ordinary variable.
39. State the major differences between Array and Structure?
40. What is the difference between Structure and Union?
41. What is Random Access?
42. Write a Program in C to add two matrices and display result.
43. What is recursion in C?
44. What is a return statement in a function?
45. What is the advantage of using functions in C?
46. What are character arrays?
47. What is the difference between actual arguments and formal arguments?
48. What is the work of fprintf() function?
49. What is the default label in a switch statement?
50. What is a structure pointer?
51. What are caller and callee function in C?
52. Explain Pass by value and Pass by reference with example in function.
53. What does the strlen () and strcmp () string function perform?
54. What is the difference between malloc() and calloc()?
55. Write a C program to search an integer in an array.
56. Write a C program to store record of 10 students in a structure. The student record has name, roll
number and marks obtained in programming.
57. Write a C program to find the first 10 fibonacci numbers.
58. How do you access structure members?
59. Write a C program to show dynamic memory allocation.
60. Implement a structure Student that contains name, roll number and marks obtained and determine
the grade and generate the marksheet.
61. Write a Program in C to check whether given string is palindrome or not.
62. Write a C program to check if the number entered from the keyboard is a prime number.
63. Write a C program to demonstrate the use of gets() and puts() functions.
64. Write a Program in C to read and display along with copy the contents of a file to another file.
65. Write down the recursive code to compute factorial of an integer n.