Questions
What will be the output of the given program?
int main()
{
printf(Hello World\\n);
main();
return 0;
}
- Infinite loop
- Hello World is printed 65535 times
- Error: Calling main() function is not allowed
- Error: Stack overflow
- None of these
Find out the output of the given program or error if any.
int main()
{
void swap(int,int);
int a=10, b=20;
swap(a,b); //Line 6
printf(%d,%d,a,b);
getch();
}
void swap( int x, int y) //Line 9
{
int temp=x; x=y; y=temp;
}
- 10, 20
- 10, 10
- 20, 10
- 20, 20
- Error in the program
What will be the output of the given program?
int main()
{
displayOut();
return 0;
}
int displayOut()
{
printf(Hi I am Robot\\n);
}
- Compiles with no warning and error messages
- Compiles with warning: conflicting types for dispalyOut
- Does not compile, gives error : dispalyOut not declared
- Compiles but throws error while linking
- Hi I am Robot
Which of the following statements about the given program is correct?
int fun(int, int);
int main()
{
int x=fun(2,3);
}
fun (int x, int y) //Line 7
{
int x; //Line 8
x = 20;
return x; //Line 10
}
- Line 7 should be like => int fun (int x, int y)
- At line 8 error: ‘x’ redeclared as different kind of symbol
- At line 10 error : return of local variable ‘x’
- No error
- None of the above
Find out the output of the given program or error if any.
Int main()
{
printf(Hello from main,);
int inside()
{
printf(inside,);
int deepinside()
{
printf(and deepinside function\\n);
}
}
}
- Hello from main, inside, and deepinside function
- Hello from main, inside
- Hello from main, and deepinside function, inside
- Error in the program
- None of the above