C Programming and Problem Solving
Questions 341 to 350
341.
|
What
is/are the default storage class for functions?
I. Auto.
II. Register.
III. Static.
|
||||||||||
Find the
output of the following program
int
main()
{
int
a[5]={1,2,3};
int
i;
for(i=0;i<5;i++)
printf(“%d”,a[i]);
}
|
|||||||||||
What is
the result of the following code?
void
main( ) {
int x = 0;
for( x =1;
x<4; x++ );
printf(
“x=%d, ”, x);
}
|
|||||||||||
External
variables are stored in which segment?
|
|||||||||||
Find the
output of the following program
int
main()
{
switch(4)
{
default:printf(“hello1”);
case1:printf(“hello2”);
case2:printf(“hello3”);
}
|
|||||||||||
Find the output of the following program
int
main()
{ int a=10,b=20,c;
c=add(a,b);
printf(“%d”c);
}
int
add(int x,int y)
{
return(x+y);
return(x);
return(y);
return(x-y);
return(y+1);
}
|
|||||||||||
Find the
output of the following program
int
main()
{
char
ch1,ch2,ch3;
ch1=’a’;
ch2=’b’;
ch3=ch1+ch2;
printf(“%d”,ch3);
}
|
|||||||||||
Find the
output of the following program
int
main()
{
int
a,b,n;
a=100;
b=200;
n=printf(“%d%d”,a,b);
printf(“%d”,n);
}
|
|||||||||||
Find the
output of the following program
int
main()
{
int
i=1;
while(i<++i);
printf(“%d”,i);
}
|
|||||||||||
Which of
the following statement is incorrect?
|
Answers
341.
|
Answer : (c)
Reason : default
storage class for function is static
|
Answer : (d)
Reason : remaining
elements initialize with zeros.
|
|
Answer : (d)
Reason : for
loop end with semicolon (;).
|
|
Answer : (d)
Reason : external
and static variables are stored into data segment
|
|
Answer : (e)
Reason : there
is no space between case value and no break statement in each case.
|
|
Answer : (c)
Reason : return
statement skip the remaining statements and return value to calling function
|
|
Answer : (c)
Reason : char
modifier is signed char
|
|
Answer : (d)
Reason : printf
statement returns no of characters printing on stdout device.
|
|
Answer : (e)
Reason : ++i
pre increment operator.
|
|
Answer : (b)
Reason : we
can’t run program without main function.
|
really useful blog post. helpful for developers.
ReplyDeleteanimation and web design courses in coimbatore
web development courses in coimbatore
seo course in coimbatore