What will be the output of the following “C” program?

Loading

Practice Functions – What will be the output of the following “C” program?


int main ()
{
int i = 2, j = 3, k = 1;
swap (i, j);
printf ("%d %d", i, j);
}
swap (int i, int j)
{
int temp;
temp = i; i = j; j = temp;
}

Which of the following function is correct that finds the length of a

Loading

Practice Functions – Which of the following function is correct that finds the length of a string?

Is there any difference int the following declarations?

Loading

Practice Functions – Is there any difference int the following declarations?


int fun(int arr[]);
int fun(int arr[2]);

Which function will not be called in the following program?

Loading

Practice Functions – Which function will not be called in the following program?


#include
void first()
{
printf("first");
}
void second()
{
first();
}
void third()
{
second();
}
void main()
{
void (*ptr)();
ptr = third;
ptr();
}

What is the output of the following problem ?

			  		

Loading

Practice Functions – What is the output of the following problem ?


#include

int main() {
int factorial(int n);
int i,ans;
ans = factorial(5);
printf("
Factorial by recursion = %d
", ans);
return 0;
}
int factorial(int n)
{
if (n <= 1)
return (1);
else
return ( n * factorial(n-1));
}

What is the output of the following problem ?

			  		

Loading

Practice Functions – What is the output of the following problem ?


#include
int main()
{
int j,ans;
j = 4;
ans = count(4);
printf("%d",ans);
return 0;
}
int count(int i)
{
if ( i < 0)
return(i);
else
return( count(i-2) + count(i-1));
}

What will be the output of the following program on GCC compiler?

Loading

Practice Functions –

What will be the output of the following program on GCC compiler?

#include<stdio.h>  
#include<string.h>
int main() {
char dest[] = {97, 97, 0};
char src[] = "aaa";
int i;
if((i = memcmp(dest, src, 2))==0) {
printf("Got it");
}
else {
printf("Missed");
}
return 0;
}

What will be the output of the following program on GCC compiler?

Loading

Practice Functions –

What will be the output of the following program on GCC compiler?

#include<stdio.h>  
#include<stdlib.h>
int main() {
char *i = "55.555";
int result1 = 10;
float result2 = 11.111;
result1 = result1 + atoi(i);
result2 = result2 + atof(i);
printf("%d, %f", result1, result2);
return 0;
}

What will be the output of the following program on GCC compiler?

Loading

Practice Functions –

What will be the output of the following program on GCC compiler?

#include<stdio.h>  
int main() {
int i;
i = scanf("%d %d", &i, &i);
printf("%d ", i);
return 0;
}

What will be the output of the following program on GCC compiler?

Loading

Practice Functions –

What will be the output of the following program on GCC compiler?

#include<stdio.h>  
#include<math.h>
int main() {
float i = 2.5;
printf("%f, %f", floor(i), ceil(i));
return 0;
}