Programming for Problem Solving - B.Tech 2nd Semester Examination, 2025 (Old Course)
Programming for Problem Solving
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
-
Which of the following cannot be a variable name in C?
-
Which of the following typecasting is accepted by C language
-
Which of the following is NOT possible with any 2 operators in C?
-
Functions can return enumeration constants in C?
-
C preprocessors can have compiler specific features.
-
How many number of pointer (*) does C have against a pointer variable declaration?
-
Which of the following is not possible statically in C language?
-
What will be the value of the following assignment expression?
(x = foo())!=1 considering foo() returns 2 -
Comment on the following C statement
n=1; printf("%d, %d ", 3*n, n++); -
What are the elements present in the array of the following C code?
int array[5]={5};
-
Explain the major components of a computer system. How does the operating system help in program execution?
-
Write an algorithm and flowchart to find the largest of three numbers.
-
Explain the different arithmetic operators in C. Write the rules for evaluating arithmetic expressions with precedence and associativity.
-
Write a program to reverse a number using a loop. Explain the concept of an infinite loop with examples. Why do infinite loops occur?
-
Explain array declaration and initialization with examples for 1-D and 2-D arrays. Also explain the concept of bound checking.
-
Write a C program to perform Binary Search on a sorted array.
-
What is call by reference? How is passing an array to a function an example of call by reference? Explain with code.
-
Write a program that reads marks of 5 students into an array and uses a function to compute the average. Demonstrate passing an array to a function.
-
Define a structure Student with name, roll, marks. Write a C program to input data for 3 students and print it.
-
Write a note on accessing structure elements using (a) dot operator, (b) pointer-to-structure. Give examples.
-
Explain the concept of pointers in C. How are pointers defined and used? Illustrate with a program that swaps two numbers using pointers.
-
Write a C program using pointers to reverse an array in-place. Explain how pointers are used in the program.
-
Write a recursive C program to find the factorial of a number. Also explain base case and recursive case.
-
Explain the Ackermann function. Write a recursive program for it. Why is it not suitable for large values?