C Program find Output code snippet SET - 2
Point out the correct statements are correct about the program below?
#include<stdio.h>
int main()
{
char ch;
while(x=0;x<=255;x++)
printf("ASCII value of %d character
%c\n", x, x);
return 0;
}
|
||||||||||||||||
Workspace
|
2.
|
Which of the following is the correct usage of conditional operators
used in C?
|
|||||||||||||||
Workspace
|
3.
|
What will be the output of the program?
#include<stdio.h>
#include<math.h>
int main()
{
float n=1.54;
printf("%f,
%f\n", ceil(n), floor(n));
return 0;
}
|
|||||||||||||||
Workspace
|
4.
|
What will be the output of the program?
#include<stdio.h>
int main()
{
float d=2.25;
printf("%e,",
d);
printf("%f,",
d);
printf("%g,",
d);
printf("%lf",
d);
return 0;
}
|
|||||||||||||||
Workspace
|
5.
|
If a function contains two return statements
successively, the compiler will generate warnings. Yes/No ?
|
|||||||
Workspace
|
6.
|
Point out the error in the program
#include<stdio.h>
int main()
{
int i;
#if A
printf("Enter any number:");
scanf("%d", &i);
#elif B
printf("The number is odd");
return 0;
}
|
|||||||||||||||
Workspace
|
7.
|
What will be the output of the program ?
#include<stdio.h>
int main()
{
float arr[] =
{12.4, 2.3, 4.5, 6.7};
printf("%d\n", sizeof(arr)/sizeof(arr[0]));
return 0;
}
|
|||||||||||||||
Workspace
|
8.
|
Is there any difference int the following declarations?
int fun(int arr[]); int fun(int arr[2]); |
|||||||
Workspace
|
9.
|
What will be the output of the program (Turbo C in 16 bit platform
DOS) ?
#include<stdio.h>
#include<string.h>
int main()
{
char *str1 = "India";
char *str2 = "BIX";
char *str3;
str3 =
strcat(str1, str2);
printf("%s
%s\n", str3, str1);
return 0;
}
|
|||||||||||||||
Workspace
|
10.
|
Which of the following statements correct about the below program?
#include<stdio.h>
int main()
{
union a
{
int i;
char ch[2];
};
union a u1 =
{512};
union a u2 =
{0, 2};
return 0;
}
|
|||||||||||||||
Workspace
|
11.
|
Does there exist any way to make the command-line arguments available
to other functions without passing them as arguments to the function?
|
|||||||
Workspace
|
12.
|
What will be the output of the program?
#include<stdio.h>
int get();
int main()
{
const int x =
get();
printf("%d",
x);
return 0;
}
int get()
{
return 20;
}
|
|||||||||||||||
Workspace
|
13.
|
Point out the error in the program.
#include<stdio.h>
#include<stdlib.h>
int fun(const union employee
*e);
union employee
{
char name[15];
int age;
float salary;
};
const union employee
e1;
int main()
{
strcpy(e1.name, "A");
fun(&e1);
printf("%s
%d %f", e1.name, e1.age, e1.salary);
return 0;
}
int fun(const union employee
*e)
{
strcpy((*e).name, "B");
return 0;
}
|
|||||||||||||||
Workspace
|
14.
|
What function should be used to free the memory allocated by calloc() ?
|
|||||||||||||||
Workspace
|
15.
|
Point out the correct statement which correctly free the memory
pointed to by 's' and 'p' in the following program?
#include<stdio.h>
#include<stdlib.h>
int main()
{
struct ex
{
int i;
float j;
char *s
};
struct ex *p;
p =
(struct ex
*)malloc(sizeof(struct ex));
p->s
= (char*)malloc(20);
return 0;
}
|
|||||||||||||||
Workspace
|
16.
|
What do the following declaration signify?
void *cmp();
|
|||||||||||||||
Workspace
|
17.
|
What will be the output of the program?
#include<stdio.h>
int main()
{
char huge
*near *far *ptr1;
char near
*far *huge *ptr2;
char far
*huge *near *ptr3;
printf("%d,
%d, %d\n", sizeof(**ptr1), sizeof(ptr2), sizeof(*ptr3));
return 0;
}
|
|||||||||||||||
Workspace
|
18.
|
Point out the error in the following program.
#include<stdio.h>
void display(int (*ff)());
int main()
{
int show();
int (*f)();
f =
show;
display(f);
return 0;
}
void display(int (*ff)())
{
(*ff)();
}
int show()
{
printf("IndiaBIX");
}
|
|||||||||||||||
Workspace
|
19.
|
We can modify the pointers "source" as well as
"target".
|
|||||||
Workspace
|
20.
|
Will the program outputs "IndiaBIX.com"?
#include<stdio.h>
#include<string.h>
int main()
{
char str1[]
= "IndiaBIX.com";
char str2[20];
strncpy(str2,
str1, 8);
printf("%s",
str2);
return 0;
}
|
|||||||
|
Comments
Post a Comment