Programming for Problem Solving - B.Tech 1st Semester Exam., 2018 (New)
Programming for Problem Solving
Instructions:
- All questions carry equal marks.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
-
Which of these, best describes an array?
-
How do you initialize an array in C?
-
When does the segmentation fault occur?
-
What is the output of the following program?
void main(){
int a;
a=1;
while(a<=1)
if(a%2)
printf("%d", a++);
else
printf("%d", ++a);
printf("%d", a+10);
} -
What is the output of the following code?
void main()
{
int i;
i=0;
if(i=15,10,5)
printf("Programming %d",i);
else
printf("Skills %d",i);
getch();
} -
What will be printed as the result of the operation below?
main()
{
char s1[]="Cisco";
char s2[]="systems";
printf ("%s", s1);
} -
Process of inserting an element in stack is called
-
Consider the following segment of C-code:
int j, n;
j=1;
while (j<=n)
j=j*2;
The number of comparisons made in the execution of the loop for any n>0 is: (Base of log is 2 in all options) -
The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is
-
What is the output of following program?
#include <stdio.h>
int main()
{
int a=1;
int b=1;
int c=a || --b;
int d=a-- && --b;
printf("a=%d, b=%d, c=%d, d=%d", a, b, c, d);
return 0;
}
-
How array and pointers are related? Explain with the help of suitable diagrams.
-
Write a C program to count the number lines input by the user.
-
Explain the difference between call by reference and call by value with the help of a suitable example.
-
With the help of an example, differentiate between static and dynamic memory allocations.
-
What are library functions and their users in C language? Can we write our own functions and include them in C library?
-
Write a "recursive" C program to print—
(a) Fibonacci series;
(b) factorial of a given number.
-
Write the differences between structure and union. Compare them with the help of an example.
-
Write a C program to convert an infix expression into postfix expression. In particular, an infix expression: \((1-2)*(4+5)\) will have postfix expression: \(12-45+*\).
-
Write a C program to illustrate reading of data from a file.