Lines Which Gives Description of What Is Written in Code (Something Like This) ... Answer Is: - Comments
Lines Which Gives Description of What Is Written in Code (Something Like This) ... Answer Is: - Comments
int x=3;
if(x==2);
x=0;
if(x==3)
x++;
else
x+=2;
printf(x)
}
ans
2
ans
10
3) # include<stdio.h>
void main()
{
int a = 10,b;
b = a++ + ++a;
printf("%d %d %d %d",b,a++,a,++a);
}
Ans : 22 13 13 13
4) # include<stdio.h>
void main()
{
float a = 2.3;
int b = 3;
a = b / 2 + b * 8 / b - b + a /3;
printf("%f"a);
}
Ans : 6.76
6)
if we manipulate array elements in a functions will those changes be reflected
in actual array in main program... answer is no
length of array
answer is 20...because a[20] will reserve 20 memory locations
11) x= 26,m=11,n=16
b. 10 100 (1)
a. 1==1 is TRUE
b. 1==49 is TRUE
c. 1==1 is FALSE
d. 1==49 is FALSE
Feedback
a)Correct-because == has higher precedence than ?:
b)Incorrect- because == has higher precedence than ?:
b)Incorrect- because == has higher precedence than ?:
b)Incorrect- because == has higher precedence than ?:
main()
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}
a. 1,1,1,1,1
b. 2,1,2,3,1
c. 0,0,1,3,1
d. None of the above
Feedback:
17) main()
{
int j=1;
while(j<=255);
{
printf(%c %d\n”,j, );
j++;
}
}
a. 1…255
b. 11
c. Infinite loop
d. None of the above
Feedback:
A.) Incorrect- The program goes into a infinite loop. this occurs because of the semi-
colon after the while statement. It is a loop without any updation statements. so it
does not come out of the loop.
B.) Incorrect-. The program goes into an infinite loop. This occurs because of the semi-
colon after the while statement. It is a loop without any updation statements. So it
does not come out of the loop.
C.) Correct: The program goes into an infinite loop. This occurs because of the semi-
colon after the while statement. It is a loop without any updation statements. So it
does not come out of the loop.
Incorrect - The program goes into an infinite loop. This occurs because of the semi-
colon after the while statement. It is a loop without any updation statements. So it does
not come out of the loop.
18) When you pass an array as an argument to a function , what actually gets
passed?
a. m a n
b. no output
c. mmmm
aaaa
nnnn.
d. None of the above
Feedback
A.) Incorrect-all the characters of string s are printed 4 times since all the arguments in
the printf statement are equivalent forms
B.) Incorrect- all the characters of string s are printed 4 times since all the arguments in
the printf statement are equivalent forms
C.) Correct-.-all the characters of string s are printed 4 times since all the arguments in
the printf statement are equivalent forms
D.) Incorrect--all the characters of string s are printed 4 times since all the arguments in
the printf statement are equivalent forms
20) main()
*i=10;
*j=20;
printf(“%d”, *i);
*i=*i**i;
*j=*j**j;
a) 101
b) 20
c) 100
d) 10
20) main()
int a;
a) 2
b) 10
c) 1 (Ans)
d) 420
21) main()
j=i,j?(i,j)?i:j:j;
printf(“%d%d”, i,j);
a) 35 45
b) 45 45
c) 35 35 (Ans)
d) None
22) main( )
int a[2][2];
int i,j;
for(i=1;i<=2; i++)
for(j=1;j<=2;j++)
if(j==1)
a[i][j]=1;
else
a[i][j]=0;
printf(“%d”, a[i][j]);
}
What will be the output:
a) 0000
b) 1111
c) 1010
d) 1001
Ans: True
24) main( )
struct imp
char c[];
char *b;
};
struct dept
char *d;
struct imp e;
};
a) error
b) HR
c) HR Sales (Ans)
d) Accts Sales
a) arr (Ans)
b) &arr (Ans)
c) arr[0]
d) arr[1]
29) If a file contains the line “I am a boy\r\n” then on reading this line into the
array str[ ] using fgets( ) what would str[ ] contains?
1. I am a boy\r\n\0
2. I am a boy\r\0
3. I am a boy\n\0
4. I am a boy
int a=250
1. 250
2. 251
3. 249
33) A do-while loop is useful when we want that the statements within the loop
must be executed
1. Only Once
2. At least Once
3. More than Once
4. None of the above
34) In what sequence the initialization, testing and execution of body is done in a
do-while loop
1. Initialization, execution of body, testing
2. Execution of body, Initialization, testing
3. Initialization, testing, execution of body
4. None of the above
{
i++;
}
3. int true=0, false; 4. int y, x=0;
while (true) do
{ {
false = 1; y = x;
} } while (x = = 0);
int i = 1;
for (;;)
if (i > 10)
break ;
main( )
Q.38 The variables commonly used in C functions are available to all functions in a program.
(True/False)
Q.39 To return the control back to the calling function we must use the keyword return.
(True/False)
Q.40 The same variables names can used in different functions, without any conflict.
(True/False)
Q.42 A function may contain more than one return statement. (True/False)
Q.43 A function may be called more than once from any other function. (True/False)
Q.47 How many times the following program would print ‘Jamboree’?
main( )
printf( “\nJamboree”);
main( );
ptr += 3;
return (ptr);
int main()
x = "HELLO";
y = myFunc (x);
return 0;
1. y = HELLO
2. y = ELLO
3. y = LLO
4. y = LO
int a=10,b;
b=a++ + ++a;
printf("%d,%d,%d,%d",b,a++,a,++a);
1. 12,10,11,13
2. 22,10,11,13
3. 22,11,11,11
4. 22,13,13,13