c lang online Test

void main() { printf(“sizeof (void *) = %d \n”, sizeof(void*)); printf(“sizeof (int *) = %d \n”, sizeof(int*)); printf(“sizeof (double *) = %d \n”, sizeof(double*)); printf(“sizeof(struct unknown *) = %d \n”, sizeof(struct unknown *)); }
no out put
Compiler Error
sizeof (void *) = 2 sizeof (int *) = 2 sizeof (double *) = 2 sizeof(struct unknown *) = 2
syntax error
main() { char *p; p="Hello"; printf("%c\n",*&*p); }
H
syntax error
compiler error
E
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d", BLACK,BLUE,GREEN); }
no output
syntax error
0..1..2
compiler error
#include char *someFun1() { char temp[ ] = "string"; return temp; } char *someFun2() { char temp[ ] = {'s','t','r','i','n','g'}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }
syntax error
some garbage value
Compiler Error
no out put
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
1
Compiler Error
syntax error
2
int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }
Compiler Error
syntax error
10
1
main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }
Compiler error: Cannot increment a void pointer
syntax error
memory address
no out put
Recursive functions are executed in a
Last in First out order
First in First out order
Are maintained in a stack
None of the above
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
Compiler Error
0
1
2
main() { int i = 3; for ( ; i++=0 ;) printf(“%d”,i); }
Compiler error: Lvalue required in function main
syntax error
some garbage value
no out put
Are the following two declarations same? char far *far*scr; char far far ** scr ;
True
False
Can we pass a variable argument list to a function at run-time?
True
False
Can a structure contains a pointer to itself
True
False
Is it necessary that size of all elements in a union should be same?
True
False
Since enumerations have integral type and enumeration constants are of type int can we freely intermix them with other integral types, without errors?
True
False
Can we have an array of bit fields?
True
False
In the following code #include main( ) { FILE *fp ; fp = fopen ( "trial", "r" ) ; } fp points to
A structure which contains a char pointer which points to the first character in the file
The name of the file
The first character in the file
None of the above
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 contain?
"I am a boy\r\0"
"I am a boy\n\0"
"I am a boy"
"I am a boy\r\n\0"
To print out a and b given below, which printf() statement would use? float a = 3.14; double b = 3.14;
printf ( “%f %f”, a, b) ;
printf ( “%Lf %f”, a, b) ;
printf ( “%Lf %Lf”, a, b) ;
printf ( “%f %Lf”, a, b ) ;
What does the following program do? main( ) { unsigned int num ; int i ; scanf ("%u", &num) ; for (i=0;i<16;i++) printf(“%d",(num< It prints all odd bits from num
It prints binary equivalent of num.
It prints all even bits from num.
None of the above
/
Error
e
d
abcdefgh

Are the three declarations char **apple, char *orange[ ], and char cherry[ ][ ] same?
True
False
The preprocessor can trap simple errors like missing declarations, nested comments or mismatch of braces
True
False
To tackle a double in printf() we can use %f, whereas in scanf() we should use %lf.
True
False
The binary equivalent of 5.375 is
101.011
101.101 1 10111
101011
None of the above
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 
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:

ccccccccc

Tags:

cccccccccc

Comments

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


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


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
Ram Bothe
M.C.M.
1 Follower
Tests: 2

Your Facebook Friends on WizIQ

More Tests By Author

Learn c programming
46 Questions | 313 Attempts

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect