Programming for Problem Solving (3110003) MCQs

MCQs of Functions

Showing 21 to 29 out of 29 Questions
21.
What is the output?

int show(int b)
{
    printf("%d,",b);
}
void main()
{
   show(5);
   show(10);
}

(a) 10,5
(b) 5,10
(c) 0,0
(d) Error
Answer:

Option (b)

22.
What is the return-type of the function sqrt()?
(a) int
(b) float
(c) double
(d) depends on the data type of the parameter
Answer:

Option (c)

23.
Choose correct statements about C Language pass by value.
(a) Pass by value copies the variable value in one more memory location.
(b) Pass by value does not use Pointers.
(c) Pass by value preserves value of original variable
(d) All of these
Answer:

Option (d)

24.
What is the output?

int myshow(int b)
{
    printf("%d, ", b);
}
void main()
{
   int a=10;
   myshow(a);
   myshow(&a);
}

(a) 10, 10,
(b) 10, Some address
(c) 10, Some address (With compiler warning)
(d) Error
Answer:

Option (c)

25.
What is the output?

int myshow(int *);
void main()
{
   int a=10;
   myshow(&a);
}
int myshow(int *k)
{
    printf("%d", *k);
}

(a) Some address
(b) 10
(c) Blank
(d) Error
Answer:

Option (b)

26.
What is the output?

void myshow(int *);
void main()
{
   int a=10;
   printf("%d ",a);
   myshow(&a);
   printf("%d",a);
   
}
void myshow(int *k)
{
   *k=20;
}

(a) 10 10
(b) 20 20
(c) 10 20
(d) Error
Answer:

Option (c)

27.
Following function belongs to which category?
void print10()
{
printf("10");
}
(a) Function with argument but no return value
(b) Function with no argument and no return value
(c) Function with no argument but returns a value
(d) Function with argument and returns a value
Answer:

Option (b)

28.
Following function belongs to which category?
int get10(void)
{
return 10;
}
(a) Function with argument but no return value
(b) Function with no argument and no return value
(c) Function with no argument but returns a value
(d) Function with argument and returns a value
Answer:

Option (c)

29.
Following function belongs to which category?
void showNumber(int num)
{
printf("Number: %d", num);
}
(a) Function with argument but no return value
(b) Function with no argument and no return value
(c) Function with no argument but returns a value
(d) Function with argument and returns a value
Answer:

Option (a)

Showing 21 to 29 out of 29 Questions