BELOW ARE 5 MULTIPLE CHOICE QUESTIONS GIVEN BELOW IN WHICH ONE OR MORE THAN ONE OPTIONS ARE CORRECT . ( KINDLY PROVIDE RIGHT SOLUTION NEEDED URGENTLY FOR PRACTICE) ---------------------------------------------------------------- Q1:- The C++ unexpected() function is called in which of the following circumstances ? A) when there is no appropriate catch block in the calling function , to catch an exception thrown by the B) When a function throws an exception unexpectedly , before a catch block is encountered C) when something unexpected happens during normal program execution D) when a function is called with parameters which do not match its declaration E) when a function throws an exception which is not in the function definition's throw list.
BELOW ARE 5 MULTIPLE CHOICE QUESTIONS GIVEN BELOW IN WHICH ONE OR MORE THAN ONE OPTIONS ARE CORRECT . ( KINDLY PROVIDE RIGHT SOLUTION NEEDED URGENTLY FOR PRACTICE)
----------------------------------------------------------------
Q1:- The C++ unexpected() function is called in which of the following circumstances ?
A) when there is no appropriate catch block in the calling function , to catch an exception thrown by the
B) When a function throws an exception unexpectedly , before a catch block is encountered
C) when something unexpected happens during normal program execution
D) when a function is called with parameters which do not match its declaration
E) when a function throws an exception which is not in the function definition's throw list.
Q2 ) :- Which of the following statements correctly describe exceution of the highlighted command ?
$qrep ^root /etc/passwd
root:qqed262w7tvxq:0:0:0000~admin(0000), ,258, :/:/bin/tcsh
$su
A) the current directory will be changed to '/'
B) the environment will be the same as though root (super user ) had logged onto the system.
C) the user will be prompted for a password and then /bin/tcsh will be executed .
D) the system will execute /bin/sh . the current directory will not be changed.
E) the user will be prompted for a password and then /bin/sh will be executed.
Q3 :- The ANSI C function below causes the program in which it runs to malfunction . Which of the following connection will help to perform function successfully ?
/* Return a count of all the bits set in bytes */
int bitcount (unsigned char c)
{
unsigned char x , b , count =0;
for (b = 0 , x= 1 ; !(x & 0x100); ++b, x <<=1) {
if (x | c )
++count;
}
return count;
}
A) change the type of x to a type larger than unsigned char.
B) remove the extraneous variable b.
C) change the return type to unsigned char .
D) change if ( x | c) to if ( x & c) inside the for loop.
E) change ! (c & 0x100) to ( x < 0x100) inside the for loop.
Q4:- Which of the following statements accurately describe the C++ code except below ?
int* arr = new int [10];
delete arr;
A) delete will fail.
B) the compiler will emit a diagnostic error.
C) an exception may be thrown at runtime .
D) delete[] arr; must be used to properly deallocate arr.
E) the free-store may be corrupted.
Q5 :- Which of the following are differences between signed and unsigned variations of the same integer type in a 2's complement.
A) the range of the signed and unsigned variations of the same integer type are equivalent in size and numeric maximum value and minimum .
B) the range of the unsigned variations of an integer type is twice that of the signed variation.
C) A negative value, expressed as a signed integer , will be expressed as a positive value greater than the maximum value of the signed integer , if expresses as an unsigned integer of the same size.
D) they have the same size , but the signed variation range is centered around 0 ( zero0 , and the unsigned variation range has a lower bound of 0 (zero)
E) the representation of a signed integer has one additional bit for the sign.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps