Here, are some sample questions based on “C Programming language”. Read it carefully as these questions will help you in cracking any interview.
Question -6) What is scope & storage allocation of extern and global variables?
Extern variables are global variables. These variables belong to the external storage class and are stored in the system’s main memory. They are declared in a separate source file which could be outside the current program scope. The scope of these variables is global.
Global variables are variables declared above the main function. They are accessible throughout the program. They have 0 as the default value.
Question -7) What is scope & storage allocation of register?
Register variables are storage allocated in the CPU registers. Since they are stored in the CPU registers, their storage and accessibility is much easier and faster than other variables. The scope of register variables is local to the blocks in which they are defined.
Question -8) What is scope & storage allocation of static and local variables?
The storage allocation of static variables is done at the beginning of program execution. After the program terminates, the memory is reallocated. Scope of static variables is local to the block within which they are defined.
Local variables are variables defined within a function or program. Their default value is a garbage value and they are accessed only by the particular function or program.
Question -9) What is the difference between 'break' and 'continue' statements?
The break keyword is used to terminate a loop or exit from a block. After exiting, the program control jumps to the statement after the loop or block.
The continue keyword is used to skip a current iteration and move to the next iteration.
Question -10) What is the difference between uses of 'for' and 'while' loops?
When a user wants to initialize, check condition and increment or decrement the value of a variable in a single statement, and using an iterative loop, then the loop used may be for loop.
When the user wants to initialize, check condition and increment or decrement value not using a single iterative loop, then he/she may use the while loop. Only one condition can be checked using the while loop.
Question -6) What is scope & storage allocation of extern and global variables?
Extern variables are global variables. These variables belong to the external storage class and are stored in the system’s main memory. They are declared in a separate source file which could be outside the current program scope. The scope of these variables is global.
Global variables are variables declared above the main function. They are accessible throughout the program. They have 0 as the default value.
Question -7) What is scope & storage allocation of register?
Register variables are storage allocated in the CPU registers. Since they are stored in the CPU registers, their storage and accessibility is much easier and faster than other variables. The scope of register variables is local to the blocks in which they are defined.
Question -8) What is scope & storage allocation of static and local variables?
The storage allocation of static variables is done at the beginning of program execution. After the program terminates, the memory is reallocated. Scope of static variables is local to the block within which they are defined.
Local variables are variables defined within a function or program. Their default value is a garbage value and they are accessed only by the particular function or program.
Question -9) What is the difference between 'break' and 'continue' statements?
The break keyword is used to terminate a loop or exit from a block. After exiting, the program control jumps to the statement after the loop or block.
The continue keyword is used to skip a current iteration and move to the next iteration.
Question -10) What is the difference between uses of 'for' and 'while' loops?
When a user wants to initialize, check condition and increment or decrement the value of a variable in a single statement, and using an iterative loop, then the loop used may be for loop.
When the user wants to initialize, check condition and increment or decrement value not using a single iterative loop, then he/she may use the while loop. Only one condition can be checked using the while loop.
Thanks for sharing this interview questions with answers, it is really helpful and I have bookmarked this page for my future reference.
ReplyDeleteC++ programming course | C Training in Chennai | C++ Training in Chennai
hello i thank you for this post. i used a part of it by modifying it but it works for me with laravel 5.3. i used only the search part.
ReplyDeleteC and C++ Training Institute in chennai | C and C++ Training Institute in anna nagar | C and C++ Training Institute in omr | C and C++ Training Institute in porur | C and C++ Training Institute in tambaram | C and C++ Training Institute in velachery