In the following code in which order the functions would be called?
a=f1 (23,14)*f2(12/4)+f3();
f3,f2,f1
The order may vary from compiler to compiler
f1,f2,f3
None of the above
Can I increase the size of a dynamically allocated array?
True
False
A near pointer uses the contents of CS register (if the pointer is pointing to code) or contents of DS register (if the pointer is pointing to data) for the segment part, whereas the offset part is stored in the 16-bit near pointer
True
False
char * abc [] = {
"Sleepy",
"Dopey" "Doc",
"Happy",
"Grumpy" "Sneezy",
"Bashful",
};
How many elements does the array abc (declared above) contain? Assume the C compiler employed strictly complies with the requirements of Standard C.
4
5
6
7
8
What would be the output of the following program ?
const int x = 5 ;
const int *ptrx ;
ptrx = &x ;
*ptrx =10 ;
printf ( "%d”, x) ;
5
10
Error
Garbage Value
What will the following program output?
main (int argc, char *argv[ ], char *env[ ] ){ int i; for (i=1; I < argc ; i++)
printf ( "%s ", env[i] )
}
Error
List of all environment variables
NULL
List of all command line arguments.
double x = -3.5, y = 3.5;
printf( "%.0f : %.0f\n", ceil( x ), ceil( y ) );
printf( "%.0f : %.0f\n", floor( x ), floor( y ) );
What will the code above print when executed?ceil =>rounds up 3.2=4 floor =>rounds down 3.2=3
-4 : 3 -3 : 4
-3 : 3 -4 : 4
-3 : 4 -4 : 3
-4 : 4 -3 : 3
-4 : 3 -4 : 3
Can I increase the size of a statically allocated array?
True
False
What would be the output of the following program?
main( )
{
int i = 32, j = 0x20, k, l , m ;
k = i | j ;
l = i & j;
m=k ^ l;
printf ("%d %d %d %d %d", i, j, k, l , m) ;
}
032323232
32 32 32 32 32
32 32 32 32 0
0 0 0 0 0
int x[] = {1, 2, 3, 4, 5};
int u;
int *ptr = x;
????
for( u = 0; u < 5; u++ )
{
printf("%d-", x[u]);
}
printf( "\n" );
Which one of the following statements could replace the???? in the code above to cause the string 1-2-3-10-5- to be printed when the code is executed?
*(ptr[ 3 ]) = 10;
*ptr[ 3 ] = 10;
(*ptr)[ 3 ] = 10;
*ptr + 3 = 10;
*(ptr + 3) = 10;
If the following program (myprog) is run from the command line as
myprog 1 2 3
what would be the output?
main ( int argc, char *argv[ ] )
{
int i ;
i = argv[1] + argv[2] + argv[3] ;
printf( "%d", i) ;
}
Error
6
123
“123”
A file written in text mode can be read back in binary mode
True
False
The macro va_arg is used to extract an argument from the variable argument list and advance the pointer to the next argument..
True
False
typedefs have the advantage that obey scope rules, that is, they can be declared local to a function or a block whereas #defines always have a global effect.
True
False
If the. following program (myprog) is run from the command line as myprog friday tuesday Sunday
What would be the output?
main ( int sizeofargv, char *argv[ ] )
{
while (sizeofargv )
printf ( “%s”, argv(--sizeofargv]) ;
myprog friday tuesday saturday
myprog friday tuesday
sunday tuesday friday myprog
sunday tuesday Friday