
Learn core concepts, essential formulas, and attempt practice questions designed on the latest TCS NQT testing patterns.
What is output of: void func() { static int c=0; c++; printf("%d ", c); } called twice?
Correct Answer: A) 1 2
Step-by-step Solution: Static variable c is initialized once. 1st call increments c to 1. 2nd call retains 1, increments to 2. Output is '1 2'.
Where are register variables stored?
Correct Answer: A) CPU Registers
Step-by-step Solution: register class requests the compiler to place the variable directly in high-speed CPU registers.
Static variables are initialized only once, before the main program executes.