Programming for Problem Solving - B.Tech 1st Semester Exam-2022
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.
-
What does the following declaration mean?
int *ptr [5]; -
The function malloc() is declared in which header file.
-
What is the output of:
#include<stdio.h>
int main()
{
char ch = 'Z';
printf("%d ", ch);
return 0;
} -
How is an array initialized in C language?
-
What is the return type of the fopen() function in C?
-
What will be the output of the following C Code?
#include<stdio.h>
int main()
{
int x=4, y, z;
y=--x;
z=x--;
printf("%d%d%d", x, y, z);
} -
The keyword used to transfer control from a function back to the calling function is.
-
What is the output of:
#include <stdio.h>
int main( )
{
float a = 5, b = 2;
int c,d;
c = a/b;
d = c/2;
printf("%d", d);
return 0;
} -
In C, if you pass an array as an argument to a function, what actually gets passed?
-
How is the \(3^{rd}\) element in an array accessed based on pointer notation?
-
Explain entry controlled loop and exit controlled loop with flow charts and examples.
-
Write a C program to reverse a given multi-digit number.
-
Explain break and continue keywords with suitable examples in context of managing loops.
-
What is storage classes in C. Write features (storage, default value, scope, life) of variables defined under each storage class.
-
Write a C function for Bubble sort. Analyse the time complexity of Bubble sort for each standard cases.
-
Differentiate between formal argument and actual argument with an example.
-
What is recursion? Write a recursive C program to generate \(n^{th}\) term of the Fibonacci series.
-
How string is declared and initialized? Explain any four predefined string manipulation functions with examples.
-
Write a C program to find result matrix after multiplying two given matrices using 2-D arrays.
-
Write a program to copy contents of one file to another. While doing so replace all lowercase characters to their equivalent uppercase characters.
-
Write the difference between structure and union. Compare them with the help of an example.
-
Write a program to copy the contents of one array into another in reverse order.
-
Differentiate between call-by-value and call-by-reference with suitable examples.
-
Discuss conditional operator? Write a C program to find largest of three numbers using conditional operator?
-
Write a C program that converts a string like "124" to an integer 124.
-
Write a C program using the nesting of loops to print the following pattern:
1
2 3
4 5 6
7 8 9 10