Practice Question and Answer

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

*( ( a <= 20 ) ? &b : &c ) = 30;

Q: In the following code in which order the functions would be called? a = ( f1 ( 23,14 ) * f2 ( 12/4) ) + f3() ; 780 0

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

The order may vary from compiler to compiler. Here the multiplication will happen before the addition , but in which order the functions would be called is undefined. In an arithmetic expression the parentheses tell the compiler which operands go with which operators but do not force the compiler to evaluate everything within the parentheses first.

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

-2  3  0  1

Q: We want to round off x, a Float to an Int value. The correct way to do so would be 15806 0

  • 1
    Y = ( int ) ( x + 0.5 ) ;
    Correct
    Wrong
  • 2
    Y = int ( x + 0.5) ;
    Correct
    Wrong
  • 3
    Y = ( int ) x + 0.5;
    Correct
    Wrong
  • 4
    Y = ( int ) ( ( int ) x + 0.5 )
    Correct
    Wrong
  • Show AnswerHide Answer
  • Workspace

Answer : 1. "Y = ( int ) ( x + 0.5 ) ;"
Explanation :

Answer: A) Y = ( int ) ( x + 0.5 ) ; Explanation: Rounding off a value means replacing it by a nearest value that is approximately equal or smaller or greater to the given number.   y = (int)(x + 0.5); here x is any float value. To roundoff, we have to typecast the value of x by using (int)   Example:   #include   int main ()   {     float x = 2.6;     int y = (int)(x + 0.5);     printf ("Result = %d\n", y );     return 0;   }   Result : 3

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

Floating point formats not linked

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

4  8  10

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

C++

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully

      Report Error

    Please Enter Message
    Error Reported Successfully