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)
-
- option 3, A void pointer is a pointer that has no associated data type with it. A void pointer can hold the address of any type and can be typecasted to any type.
- 6 years agoHelpfull: Yes(5) No(0)
- 1) incorrect before main fun" we can write any other functions ,but C program Execute from main.
2) yes,In union all element share a common memory location
3)yes,void pointer store any other type variable address,that can convert to other type
4)No,not initialised to any value it's contains Zero,
2,3 right - 6 years agoHelpfull: Yes(3) No(0)
- 4th and 1st options are incorrect
- 6 years agoHelpfull: Yes(1) No(1)
- 1 and 4 are wrong...static variable autointialised to zero
- 5 years agoHelpfull: Yes(1) No(0)
- Statement 3,4 correct
- 6 years agoHelpfull: Yes(0) No(0)
- Option one is right as C is a top down approach and should always approach only in that order
- 6 years agoHelpfull: Yes(0) No(1)
- 2,3 is correct
others wrong - 5 years agoHelpfull: Yes(0) No(0)
- option first is correct
- 4 years agoHelpfull: Yes(0) No(0)
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