C Language, Programming Language from Dennis Ritchie and Bell Labs Online Test

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
Description:

This is another short test on C Language to help out the students of Programming Language
Disclaimer: Content, such as images used in the questions (if any), have been picked up from various places for the sole purpose of Instruction.

Discussion

karthick

interesting

3708 days 11 hours 26 minutes ago

gagan

ooooooooooooo

3714 days 9 hours 5 minutes ago

saveki

answers

3790 days 15 hours 36 minutes ago

shyam kumar

regarding ques 10 the ans is last option *(ptr 3)

3791 days 18 hours 27 minutes ago

Rajeev Debnath

Regarding question no. 10: *(ptr 3)=10 is right answer.

3844 days 15 hours 9 minutes ago

PazzaC

Question 10 has the wrong answer!!!

It's the last option:
*(ptr 3) = 10;
and NOT the first option:
*(ptr[3]) = 10;

In fact, the first option is erroneous because the sqaure-braces denote the effective dereferencing of the array address to an individual array item (of type 'int') and so cannot be explicitly dereferencedSee more

3864 days 2 hours 19 minutes ago

K F

Question 6 has two typos in it.
1) Capital 'I' instead of 'i' in for-loop
2) No semi-colon at end of printf

3900 days 5 hours 5 minutes ago

Your Facebook Friends on WizIQ

More Tests By Author

ASP Server Controls
10 Questions | 667 Attempts

ASP.NET, Namespaces ASP.NET
10 Questions | 2028 Attempts

An ASP.NET Application
10 Questions | 437 Attempts