Home
Current Affairs January 2024

What is the correct answer?

4

Which of the following is the most preferred way of throwing and handling exceptions?

A. Throw by value and catch by reference.

B. Throw by reference and catch by reference.

C. Throw by value and catch by value

D. Throw the pointer value and provide catch for teh pointer type.

Correct Answer :

B. Throw by reference and catch by reference.


Related Questions

What is the correct answer?

4

static variable will not always have assigned value.

A. True

B. False

What is the correct answer?

4

What's wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);

A. the question mark should be an equal sign

B. the first semicolon should be a colon

C. there are too many variables in the statement

D. the conditional operator is only used with apstrings

What is the correct answer?

4

The-------------------- statement helps immediate exit from any part of the loop

A. break

B. continue

C. exit

D. All of the above

What is the correct answer?

4

What will be output if you will compile and execute the following c code?
#include 
int main()
{
float a=5.2;
if(a==5.2)
printf("Equal");
else if(a<5.2)
printf("Less than");
else
printf("Greater than");
return 0;
}

A. Less than

B. Equal

C.

Greater than

D. None of above

What is the correct answer?

4

Which of the following shows the correct hierarchy of arithmetic operations in C

A. / + *

B. * / +

C. + / *

D. * / + -

What is the correct answer?

4

The default initial value of automatic storage class is 0.

A. True

B. False

What is the correct answer?

4

In the expression - 'x + y + 3z =20'

A. x + y' is a keyword

B. 3 and 20 are constants

C. 3z is a constant

D. y is a variable and z is a constant

What is the correct answer?

4

Right shifting an operand 1bit is equivalent to multiplying it by 2.

A. True

B. False

What is the correct answer?

4

fprintf()function can be used to write into console.

A. True

B. False

What is the correct answer?

4

Which of the following is not an infinite loop

A. int i =1;
while (1)
{i++;}

B. for( ; ; );

C. int true=0< false;
while (true)
{false = 1;}

D. int y, x = 0;
do
{y = x;}
while (x==0);

What is the correct answer?

4

A continue statement causes execution to skip to

A. the return 0; statement

B. the first statement after the loop

C. the statement following the continue statement

D. the next iteration of the loop

What is the correct answer?

4

A pointer is an indication of the variable to be accessed next.

A. True

B. False

What is the correct answer?

4

The output of the following code is:
#define sqr(x= x*x) 
main()
{
int a = 10, b = 5;
printf("%d, %d", sqr(a+b),sqr(++a));
}

A. 77, 121

B. 225, 121

C. 77< 144

D. Compilation error

What is the correct answer?

4

Which of the following is not true about preprocessor directives

A. They begin with a hash symbol

B. They are processed by a preprocessor

C. They form an integral part of the code

D. They have to end with a semi colon

What is the correct answer?

4

Structures within structures cannot be created.

A. True

B. False

What is the correct answer?

4

The printf() function retunes which value when an error occurs?

A. Positive value

B. Zero

C. Negative value

D. None of these

What is the correct answer?

4

The value of an enumerated datatype can be read using scanf() function.

A. True

B. False

What is the correct answer?

4

C programs are converted into machine language with the help of

A. An Editor

B. A compiler

C. An operating system

D. None of the above

What is the correct answer?

4

The function fopen() on failure returns---------------------.

A. 0

B. NULL

C. 1

D. none of the above

What is the correct answer?

4

The output of the following code is:
void main() 
{
float a;
int x = 10, y = 3; a = x / y;
printf("%f", a); }

A. 3.999999

B. Error

C. 3

D. 3.000000

What is the correct answer?

4

Which of the following is not a standard exception built in C++.

A. std::bad_creat

B. std::bad_alloc

C. std::bad_cast

D. std::bad_typeid

What is the correct answer?

4

Each pass through a loop is called a/an

A. enumeration

B. iteration

C. culmination

D. pass through

What is the correct answer?

4

char *s[10] defines an array of ------------------------

A. pointers to strings

B. string to pointer

C. both

What is the correct answer?

4

The output of the following code is:
void main()
{
int a = 20;
printf("%d\t%d
", ++a, a);
}

A. 21 21

B. 20 21

C. 21 20

D. 20 20

What is the correct answer?

4

All macro substitutions in a program are done before compilation of the program.

A. True

B. False

What is the correct answer?

4

The output of the following code is:
int f(int a, int b); 
void main()
{
int a = 12, b=154;
printf("%d", f(a, b));
}
int f(int a, int b)
{
if (a<b) return(f(b, a));
if(b==0) return(a);
return (f(b, a % b));
}

A. 2

B. 1

C. Compilation error

D. Runtime error

What is the correct answer?

4

Which one of the following is not a valid reserved keyword in C++

A. Explicit

B. Public

C. Implicit

D. Private

What is the correct answer?

4

A multidimensional array A[10][9] can store-------- number of elements

A. 91

B. 88

C. 90

D. 89

What is the correct answer?

4

C programming language was developed by

A. Dennis Ritchie

B. Ken Thompson

C. Bill Gates

D. Peter Norton

What is the correct answer?

4

fopen() function returns a pointer to the open file.

A. True

B. False