github

Made bySaurav Hathi

MCQ Test C/C++: Functions and Recursion 1

Q1:

Which of the following permits function overloading in C++?

Tags:
Section:
Core Programming
Options:
Q2:

Which of the following does not permit function overloading in C++?

Tags:
Section:
Core Programming
Options:
Q3:

In C/C++, function overloading is similar to which of the following?

Tags:
Section:
Core Programming
Options:
Q4:

In C/C++, overloaded functions are _____________

Tags:
Section:
Core Programming
Options:
Q5:

What happens when we pass an argument by reference in C++?

Tags:
Section:
Core Programming
Options:
Q6:

In C/C++, when our function doesn’t need to return anything, which of the following keyword should be used as return type in function definition?

Tags:
Section:
Core Programming
Options:
Q7:

What are the advantages of passing arguments by reference in C++?

Tags:
Section:
Core Programming
Options:
Q8:

A member function of a class can always access the data in __________ in C++.

Tags:
Section:
Core Programming
Options:
Q9:

Which of the following cannot be passed to a function as an argument in C++?

Tags:
Section:
Core Programming
Options:
Q10:

In C/C++, whenever const objects try to invoke non-const member functions, the compiler …………………

Tags:
Section:
Core Programming
Options:
Q11:

What is a function template in C++?

Tags:
Section:
Core Programming
Options:
Q12:

Which keyword is used for coming out of recursion?

Tags:
Section:
Core Programming
Options:
Q13:

Which is correct way to declare a function without defining in C/C++?

Tags:
Section:
Core Programming
Options:
Q14:

Which function declaration is illegal in C/C++?

Tags:
Section:
Core Programming
Options:
Q15:

Which of the following C/C++ functions will execute correctly?

Tags:
Section:
Core Programming
Options:
Q16:

Can we pass function in another function as parameter in C?

Tags:
Section:
Core Programming
Options:
Q17:

Value from a function is returned by which keyword?

Tags:
Section:
Core Programming
Options:
Q18:

Return-type of the function sqrt () in C/C++ is?

Tags:
Section:
Core Programming
Options:
Q19:

Which function declaration is illegal in C/C++?

Tags:
Section:
Core Programming
Options:
Q20:

What will be the data type returned for the following C function?

#include <stdio.h>

int func()

{

return (double)(char)5.0;

}

Tags:
Section:
Core Programming
Options:
Q21:

Find error in following C function declarations?

int func(int);

double func(int);

int func(float);

Tags:
Section:
Core Programming
Options:
Q22:

Which of the following functions is used to find the first occurrence of a given string in another string in C?

Tags:
Section:
Core Programming
Options:
Q23:

What should be used to read string with spaces in C?

Tags:
Section:
Core Programming
Options:
Q24:

In C, what will be returned by the statement strcmp("ABC", "ABC");?

Tags:
Section:
Core Programming
Options:
Q25:

Which of the following return-type cannot be used for a function in C?

Tags:
Section:
Core Programming
Options:
Q26:

In C, correct way to declare function foo() which accept array of structure as argument?

Tags:
Section:
Core Programming
Options:
Q27:

Which one is not possible for given below function in C++?

F00(&s.a); //where s is a variable of type struct and a is the member of the struct.

Tags:
Section:
Core Programming
Options:
Q28:

What will be the output of  below program?

#include <stdio.h>

int *me()

{

int *p = 5;

return p;

}

int main()

{

int *k = me();

printf("%d", k);

}

Tags:
Section:
Core Programming
Options:
Q29:

The output of the C code below is

#include <stdio.h>

int *me();

int main()

{

int *k = me();

printf("hello ");

printf("%d", k[0]);

}

int *me()

{

int a[2] = {5, 8};

return a;

}

Tags:
Section:
Core Programming
Options:
Q30:

What will be the output of below C program?

#include <stdio.h>

void fun( int[ ] );

int main()

{

int ary[4] = {1, 2, 3, 4};

fun(ary);

printf("%d ", ary[0]);

}

void fun(int p[4])

{

int i = 10;

p = &i;

printf("%d ", p[0]);

}

Tags:
Section:
Core Programming
Options: