CDS Q13
CDS Q13
CDS Q13
C- PROGRAMMING LANGUAGE
#include<stdio.h>
int main ( )
{
int i = 5;
if (i = = 5) return 0;
else printf (“i is not five”);
printf (“over”);
}
results in
1
Which of the following does not correctly implements the above flow chart?
#include<stdio.h>
main ( )
{
int x = 2, y = 2;
if (x<y) return (x = x+y);
else printf (“z1”);
printf (“z1”);
printf (“z2”);
}
2
5. Choose the False statements:
(a) The scope of a macro definition need not be the entire program
(b) The scope of a macro definition extends from the point of definition to the end of the file
(c) A macro definition may go beyond a line
(d) None of the above
if (a>b)
printf (“a>b”)
else
printf (“else part”);
printf (“a<=b”);
then a <= b
will be printed if
void *voidPtr;
char *charPtr;
#include<stdio.h>
main ( )
3
{
static int x[ ] = {1, 2, 3, 4, 5, 6, 7, 8};
inti ;
for (i = 2; i<6; ++i)
x [x[i]] = x [i];
for (i = 0; i<8; ++i)
printf (“%d”, x [i]);
}
main ( )
{
static char [3] [4] = {“abcd”, “mnop”, “fghi”};
putchar (**a);
}
#include<stdio.h>
main ( )
{
int abc ( );
abc ( );
(*abc) ( );
}
int abc ( )
4
{ printf (“come”);}
char x [ ] = “SUCCESS”;
char *y = “SUCCESS”;
(a) The output of puts (x) and puts (y) will be different
(b) The output of puts (x) and puts (y) will be same
(c) The output of puts (y) is implementation dependent
(d) None of the above comments are true
5
15. Consider the following statements.
(a) Finds the hypotenuse of a triangle with sides a+2 and b+3
(b) Finds the square root of (a+2)2 + (b+3)2
(c) Finds the square root of 3*a + 4*b + 5
(d) Is invalid
main ( )
{
int a = 1, b = 2, c = 3;
printf (“%d”, a+ = (a+ = 3, 5, a));
}
will be
(a) 12 (b) 6
(c) 9 (d) 8