0% found this document useful (0 votes)
23 views5 pages

BE-C Programming - Final Qeston Bank

The document is a comprehensive question bank covering programming concepts in C and C++, organized into four units. It includes questions on programming basics, control flow, user-defined data types, advanced C programming concepts, and C++ programming principles. Each unit contains a variety of questions that require explanations, code writing, and examples related to the respective topics.

Uploaded by

xfmgfrhtxt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views5 pages

BE-C Programming - Final Qeston Bank

The document is a comprehensive question bank covering programming concepts in C and C++, organized into four units. It includes questions on programming basics, control flow, user-defined data types, advanced C programming concepts, and C++ programming principles. Each unit contains a variety of questions that require explanations, code writing, and examples related to the respective topics.

Uploaded by

xfmgfrhtxt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Question Bank

Programming in C & C++

Unit – 1 Introduction to Programming

1. What is Programming? Explain different types of programming languages.


2. What is Algorithm? Write an algorithm to print maximum number out of two given numbers.
3. Define the Flowchart. Explain different symbols used to draw Flowchart
4. Draw a flowchart to print odd numbers between 1 to 10
5. Draw a flowchart to print first ten natural numbers, 1 to 10
6. Describe the structure of a C program. Explain the significance of the following
components in a typical C program: header files, main function, comments and return
statement.
7. What is the purpose of the #include directive in a C program?
8. Explain the printf() function with various format specifiers
9. Explain the scanf() function in C
10. What is a syntax error? Give an example of a syntax error in C code
11. What is a run time error? Give an example of a runtime error in C code.
12. Differentiate: Compiler and Interpreter.
13. Discuss the various steps in program execution
14. Write declarations for four variables of different data types in C
15. List rules to name the variable/identifier in C.
16. Discuss the concept of local variable and global variable.
17. Explain storage classes in C.
18. Explain any four format specifiers.
19. What are different ways to define the constant.
20. What is operator? Explain the concept of operator precedence and associativity with suitable
example.
21. Arithmetic, relational, and logical operators in C.
22. Explain in brief the following operators: --, ||, ?:, *=, and >=.
23. Explain in brief any eight operators of C with suitable examples.
24. Differentiate pre-increment and post-increment operators with suitable example.
25. Explain the ternary operator in C.
26. What is type conversion? Explain type conversion from user-defined data type to built-in
data type and also from built-in data type to user-defined data type.
27. Write a C program to find the area and perimeter of a circle.
28. Write a C program in C to find the area of a triangle. Take the dimensions of the triangle
from the user. (A = 0.5 * height * base).
29. Classify the following variable declaration/name as valid or invalid
int 99Acre ;
int Total100;
char cellphone[10][5];
float name[5, 20];
30. What is the output of the following code?
{ int i=5, j=5 x, y; x=++i; y=j++; printf(“%d %d”, x, y); }
31. What will be the output of the following C Code:
int x = 10, y;
y = x-- - --x
printf("%d %d", x, y);

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;

Unit – 2 Control of flow, User-defined data types

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; }

Unit – 3 Advanced concepts of C programming

78. Explain the concept of pointer with example


79. Write short note on pointer to pointer in C with example.
80. Explain with example the concept of parameter passing by value and parameter passing by
reference
81. Explain the difference between „call by value‟ and „call by reference‟ in C
82. Pointer to Structure
83. What is dynamic memory allocation? Explain the difference between malloc() and calloc()
functions
84. What is Dynamic Memory Allocation? Explain malloc() and calloc() functions.
85. Discuss the concept of file management in C.
86. Explain any 4 file functions in C with example
87. How to open a file in C? Explain various file opening modes in C
88. Write a program to read 3 numbers from user using a pointer to integer and to find & print
maximum number out of these numbers
89. Write a program to accept five numbers from the user and to print its sum using a pointer
to integer (without using array).
90. Write a program to read and write array of 5 numbers using pointer to int
91. Write a program to read and write variable of type structure, say, Point having two data
elements int x and int y, using pointer to structure
92. Write a program that reads 5 integers from users and print its sum, using pointer to integer
variable.
93. Write a code to do following: define a pointer-to-integer variable, say, ptr, allocate memory to
ptr so that it can hold two integer numbers, read two numbers from user using ptr and print the
minimum of these numbers on screen using ptr
94. What is the output of the following code?
{ int a[10]={5,10,15,20,25}; int *p=a; p+=3; printf(“%d %d”, *p, *(p+3)); }
95. What is the output of the following code?
{ int x=5, *y; y=&x; x--; printf(“%d %d”, x, *y); }
96. What is the output of the following code?
{ int a=5, b=10, *c=&a, *d=&b, **e=&c, **f=&d; *c=b; *d=a;
printf(“%d %d %d %d %d %d”, a, b, *c, *d, **e, **f);}.

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

You might also like