TCS Company Programming Technical

Given the below statements about C programming language:
1) main() function should always be the first function present in a C program file
2) all the elements of an union share their memory location
3) A void pointer can hold address of any type and can be typcasted to any type
4) A static variable hold random junk value if it is not initialised

Read Solution (Total 8)

TCS Other Question

What is the output of this C code?
#include
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf("%d%d%dn", k, *p, **p);
}
a) 5 5 5
b) 5 5 junk
c) 5 junk junk
d) Compile time error
Which of the above are correct statements?
1. 2,3
2. 1,2
3. 1,2,3
4. 1,2,3,4