Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Functions Questions
C++ default arguments: which statement below is incorrect regarding default function arguments?
C++ default arguments: which statement is correct about redefinition and using function calls as defaults?
C++ default parameters: identify which declarations are invalid and choose the best summary.
C++ default arguments usage: in what effective order do omitted arguments get supplied at the call site?
C++ overloading limits: which of the following functions cannot be overloaded? (Choose the only correct option.)
C++ function overloading: which statement about parameter counts and types is correct?
In C++ default-argument rules, which of the following statements is incorrect? Read carefully and select the option that violates how default parameters work in real code.
Default parameters in C++: which statement is correct about how many parameters may be defaulted? Choose the rule that best reflects the language design.
Function overloading: which statement is correct under standard C++ rules? Assume normal overload resolution; default arguments do not change a function’s signature.
If a function has three parameters, which position(s) may legally have default arguments under standard C++ rules? Choose the most accurate statement.
Which statement is correct about constructors and default parameters in C++? Pick the option that matches the language capabilities.
Const-correctness for function parameters in C++: which statement is correct? Focus on what it means to accept constants and the restrictions on modification.
Default arguments: which statement is incorrect with respect to declaration and usage sites? Pick the option that violates best practice or standard rules.
Overloading with default arguments: which statement is correct under C++ rules? Assume you avoid ambiguity by careful design.
Where should the default value of a function parameter be specified in C++? Choose the place(s) allowed by the language (avoid duplicating across declarations).
Which of the following function prototypes is perfectly acceptable in C++ for using a default argument? Assume referenced names are declared before the prototype.
C++ default parameters: which function(s) cannot legally have default arguments?
In C programming (assume sizeof(int) = 2 bytes), what will this program print? #include
void fun(char**); int main() { char argv[] = {"ab", "cd", "ef", "gh"}; fun(argv); return 0; } void fun(char p) { char t; t = (p += sizeof(int))[-1]; printf("%s ", t); } Carefully analyze the pointer arithmetic on the char parameter and identify the string printed.
In C, what will this program print? Focus on the comma operator used in the return expression. #include
int addmult(int ii, int jj) { int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } int main() { int i=3, j=4, k, l; k = addmult(i, j); l = addmult(i, j); printf("%d, %d ", k, l); return 0; }
In C, predict the output and trace scope and parameter shadowing carefully. #include
int i; int fun1(int); int fun2(int); int main() { extern int j; int i=3; fun1(i); printf("%d,", i); fun2(i); printf("%d", i); return 0; } int fun1(int j) { printf("%d,", ++j); return 0; } int fun2(int i) { printf("%d,", ++i); return 0; } int j=1;
1
2
3
4
5