Functions & Pointers

11. What is wild pointer?

A. Pointer which is wild in nature
B. Pointer which has no value.
C. Pointer which is not initialized
D. None

View Answer


12. Address stored in the pointer variable is of type __________.

A. Integer
B. Float
C. Array
D. Character

View Answer


13. In order to fetch the address of the variable we write preceding _________ sign before variable name.

A. Percent(%)
B. Comma(,)
C. Ampersand(&)
D. Asteric(*)

View Answer


14. Comment on this
const int *ptr;

A. You cannot change the value pointed by ptr
B. You cannot change the pointer ptr itself
C. Both (a) and (b)
D. You can change the pointer as well as the value pointed by it

View Answer


15. Choose the best one
prior to using a pointer variable

A. It should be declared.
B. It should be initialized.
C. It should be both declared and initialized.
D. None of the above.

View Answer


16. Which of the following statements are correct about the given program?

#include<stdio.h>
int main()
{
printf("%p", main());
return 0;
}

A. Prints garbage value infinite times
B. Error
C. Runs infinite times without printing anything
D. None of the above

View Answer


17. What is the output of this program?

#include<stdio.h>
void fun(int a, ...)
{
printf("%d ", a);
}
int main()
{
fun(1,2,3,4);
fun(5,6,7,8,9);
return 0;
}

A. 1 5
B. 2 5
C. 5 1
D. Compilation Error

View Answer


18. What is the meaning of using static before function declaration?

static int demo(int a, int b)
{
return (a + b);
}

A. Access to static functions is restricted to the file where they are declared
B. Static means nothing, sum() is same without static keyword.
C. Function need not to be declared before its use
D. None of the above

View Answer


19. What is the output of this program?

#include<stdio.h>
int demo()
{
static int i = 0;
printf("%d ",i++);
}
int main()
{
for(int j = 0 ; j < 5 ; j++ )
{
demo();
}
}

A. 0 0 0 0 0
B. 1 1 1 1 1
C. 1 2 3 4 5
D. 0 1 2 3 4

View Answer


20. What is the output of this program?

#include<stdio.h>
int test()
{
static int n = 10;
return n--;
}
int main()
{
for(test(); test(); test())
printf("%d ", test());
return 0;
}

A. 7 4 1
B. 8 5 2
C. Infinite loop
D. Compilation Error

View Answer


21. What is the output of this program?
#include>stdio.h<
int main()
{
void test(), temp();
temp();
}
void test()
{
printf("2 ");
}
void temp()
{
printf("1 ");
test();
}

A. 1 0
B. 0 1
C. Compile time error as foo is local to main
D. Compile time error due to declaration of functions inside main

View Answer






Also check :


Discussion


* You must be logged in to add comment.