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.

Comments
K F
By: K F
1215 days 13 hours 34 minutes ago

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

K F
By: Pruthwiraj Ghadge
428 days 23 hours 33 minutes ago

Yeah I agree with this.
Program will generate errors on for loop and printf lines

For loop condition has I(capital i) and printf does not end with ;(semicolon).
Please check out.

PazzaC
By: PazzaC
1179 days 10 hours 47 minutes ago

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 dereferenced using the '*'.

Rajeev Debnath
By: Rajeev Debnath
1159 days 23 hours 38 minutes ago

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

shyam kumar
By: shyam kumar
1107 days 2 hours 55 minutes ago

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

saveki
By: saveki
1106 days 4 minutes ago

answers

gagan
By: gagan
1029 days 17 hours 33 minutes ago

ooooooooooooo

karthick
By: karthick
1023 days 19 hours 55 minutes ago

interesting

Want to learn?

Sign up and browse through relevant courses.

or fill this simple form
Name:
Your Email:
Password:
Country:
Contact no.:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as shown in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy

Your Facebook Friends on WizIQ

More Tests By Author

ASP Server Controls
10 Questions | 419 Attempts

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

An ASP.NET Application
10 Questions | 284 Attempts

Test your basic knowledge on DATASTRUCTURES, STACK
10 Questions | 953 Attempts

Connect