Functions

Q1:
How many times the program will print 'AptitudeCrack' ?
#include<stdio.h>

int main()
{
    printf('AptitudeCrack');
    main();
    return 0;
}

A 65535 times

B Infinite times

C Till stack overflows

D 32767 times

ANS:A - Infinite times

A call stack or function stack is used for several related purposes, but the main reason for having one is to keep track of the point to which each active subroutine should return control when it finishes executing. A stack overflow occurs when too much memory is used on the call stack. Here function main() is called repeatedly and its return address is stored in the stack. After stack memory is full. It shows stack overflow error.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.