BE-C Programming - Final Qeston Bank
BE-C Programming - Final Qeston Bank
Page: 1 of 5
32. What is the output of the following code?
33. { int a=5, b; b=a++ + ++a; printf(“%d %d”, a, b); }
34. What is the output of the following code?
{ int x=5, y; y=x%2?1:0; printf(“%d %d”, x, y); }
35. What is the output of the following code?
int a; float b;
printf("Enter a: ");
scanf("%d", a);
a = b + 2.5;
36. What is decision making? Explain decision making statements in C with example.
37. Write a scenario to illustrate switch - case for a menu driven program
38. Write a basic for loop that runs infinity times
39. Explain for loop with suitable example
40. Write a for loop to print from 10 to 1
41. Write a basic while loop that runs infinity times
42. Explain while loop with suitable example
43. Explain the do…while loop with suitable example
44. Discuss the use of break and continue statements with the while loop.
45. Write short note on goto statement with example
46. What is array ? Explain the declaration and initialization of one dimensional and two
dimensional array with an example
47. Differentiate between character array and string
48. What is header file? Explain any two built-in string functions from string.h header file
49. Explain in brief any five built-in functions of C for string/number manipulation
50. Write the syntax of function definition, function declaration and function calling in C
51. Explain user defined functions in C
52. Different types of functions according to return value and parameters
53. What is recursion? Write a recursive code to find N! (factorial of number N).
54. What is recursion? Write code to print Fibonacci series using recursion
55. What does the void keyword signify when used for return type in function declaration and used
as a parameter
56. Explain the concept of default parameters in function.
57. What is a command line argument?
58. Differentiate between structures and arrays. Also, write a code to read and print structure using
pointer to structure variable.
59. Discuss the concept of structure with suitable example
60. Discuss the concept of nested structure with suitable example
61. Write the syntax for accessing Structure members in C
62. Discuss the concept of union with suitable example
63. Differentiate between structures and union
64. Differentiate High Level Language and Machine Level Language.
struct s
{ int a,b; char ch; };
void main()
{int x, a[5]; printf(“%d %d %d %d”, sizeof(x), sizeof(int), sizeof(a), sizeof(s)); }
65. What is the output of the following code?
Page: 2 of 5
{ int a[10]={1,2,3,4,5,6,7,8,9}; int *p=a; p+=3; printf(“%d %d”, *p, *(p+3)); }
66. What is the output of the following code?
{ int a=5, b=10, c=15, d; d=a>b && b>c; if (d) printf(“0”); else printf(“1”);}
67. Write a code using nested loops to print the following pattern for a given number (say, n=3).
1
22
3 33
68. Write a C program to print the following pattern:
12345
1234
123
12
1
69. What is the output of the following code?
int a = 5;
int b = 3;
int c = 10;
if (a > b) {
c -= b;
if (c > a) {
a += c;
} else {
a -= b;
}
} else {
a += c;
}
a *= 2;
printf("%d\n", a);
70. Write a C program to print the following pattern:
*
**
***
****
*****
71. What is the output of the following code?
{ int a=5;
for(;a<15;)
{ printf(“\n %d”, a);
if (a>10) break;
a++;
}
}
72. Write a program to find and print maximum out of given three numbers.
73. Write a program to define and use isPrime() function that accepts one parameter and returns
true (1) if it is prime otherwise returns false (0).
74. Write a Program to test whether the given number is palindrome or not
75. Write a program to define and use the RESULT function that can accept either two or three
parameters and returns the sum of those parameters.
76. Write a program to swap values of two variables using function.
Page: 3 of 5
77. Write a program to accept name and marks of 3 subjects for five students, calculate total, and
print all information using following structure:
struct Student { char Name; int Mark1, Mark2, Mark3, Total; }
Page: 4 of 5
Unit – 4 All C++ Programming
1. What is Object Oriented Programming (OOP)? Explain the following terms in brief: Class,
Object, Encapsulation, Abstraction, Inheritance, and Polymorphism
2. Explain the difference between function-oriented programming and object-oriented
programming.
3. Explain the use of public, private and protected keywords in a class.
4. List rules for naming the variables/identifies. Explain in brief the reference variable in C++.
5. Explain the concept of operator precedence and associativity with suitable examples, and
discuss the use of Scope Resolution Operator.
6. Is it possible to define a function/method outside of the class in C++? How?
7. Explain various operators in C++
8. Using code, create a Class in C++ and make one object belonging to that class
9. Explain the concept of Inheritance in C++ with suitable example
10. Public Inheritance, Protected Inheritance, and Private Inheritance
11. The role of visibility modes (access specifiers) in Inheritance
12. Explain the concept of Friend Function
13. Discuss the concept of Abstract Class.
14. Explain the concept of class and array of objects with suitable example.
15. What is strongly typed language and type casting? Explain type conversion from UDT to built-
in data type int with suitable example.
16. Explain with example the concept of constructor and destructor with suitable example
17. Different types of Constructors
18. What is shallow copy and deep copy? Explain the use of Copy Constructor to achieve deep
copy of an object
19. Operator Overloading
20. Method Overloading vs. Method Overriding
21. Explain the concept of Method Overriding in Inheritance
22. Runtime Polymorphism with Virtual Function
23. Explain the concept of Function Overloading and Default Arguments
24. Discuss the use of static data element and static member function in a class.
25. What is generic programming? Explain the concept of templated function.
26. Template Function and Template Class
27. Template Function and its Overloading with Normal Function
28. Explain in brief the exception handling in C++.
29. Explain in brief the keywords try, catch and throw
30. Analyze the merits and demerits of Inline Function over macro and normal function
31. Discuss the use of static data element and static member function in a class
32. Write a program to overload the binary * operator with suitable example
33. Analyze the advantages and disadvantages of Inline Function over non-Inline Function
34. Write a program to overload binary operator + using friend function to add an integer n to point
P (X, Y) to produce the result P (X+n,, Y+n). That is, to add number to both, X and Y.
35. Write a program to overload binary operator + using friend function to add two Vectors V1(x1,
x2, x3, x4, x5) and V2(y1, y2, y3, y4, y4, y5), such that it adds corresponding elements. That
is, it should return V3(x1+x2, x2+y2, …, x5+y5).
36. Write a program that demonstrates the concept of Method Overriding
37. Write a program to overload the binary + operator using member function to add two 2x3
matrix objects of type Matrix-Class defined appropriately
38. Write a program (with comments and/or output) to demonstrate the role of Access
Specifier in Multi-Level Inheritance.
Page: 5 of 5