AceTheInterview
Jobs in Pune | Work better in teams | Socialize with friends | Submit Q&A | Tell a friend
Search site for 

Top 100 Interview Questions & Answers in a convenient and easy to read book!

“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”

– Ravi, California

Read more comments...

Interview Questions And Answers RSS Feed

Answers »

  1. Submitted By: johny_bravo — October 6, 2006
    +24 votes
      + -

    1> n = 0, y = 100, second condition will not be evaluated.

    2> n = 1, y = 101

    3> n = 1, y = 100

  2. Submitted By: Jas — October 14, 2006
    +5 votes
      + -

    According to MSDN:
    When a postfix | prefix operator is applied to a function argument, the value of the argument is not guaranteed to be incremented or decremented before it is passed to the function.

    The result also depends on the compiler that how it evaluates the expression.

    Here is the solution by the g++ compiler

    n = 0 , y = 100

    n = 1 , y = 101

    n = 1 , y = 101

  3. Submitted By: Saroj Kanta Behera — October 27, 2006
    -2 votes
      + -

    Given int n, i=10, j=20, x=3, y = 100;
    a) n = (i > j) && (x

  4. Submitted By: Jim Stevens — November 13, 2006
    -2 votes
      + -

    I agree with Jas

    The results are compiler specific

    In addition
    You do not state whether the statements should be considered as independent of the others

    Regards: Pedandic Pat

  5. Submitted By: Nitin — March 13, 2007
    -1 votes
      + -

    Look at the question once again –

    Given int n, i=10, j=20, x=3, y = 100;
    What is the value of n and y at the end of each of the following expressions?
    a) n = (i > j) && (x

  6. Submitted By: chekka — April 4, 2007
    not yet rated
      + -

    a)n=(i>j) && (xj(i.e 10>20) is false(0)

    So the compiler doesn’t evaluate the remaining expression.
    Thus the result is
    n=0 & y=100.

    b) n=(j-i) && (x

  7. Submitted By: rahul — December 10, 2007
    not yet rated
      + -

    n = 0 , y = 100

    n = 1 , y = 101

    n = 1 , y = 101

  8. Submitted By: shiva5256 — February 5, 2008
    -1 votes
      + -

    how can we assing a value to “n” ? the expressions are contain logical operator. i think it not possible,
    dependent upon the compliers the default values are assigned to “n”.

  9. Submitted By: shirishareddy — April 9, 2008
    not yet rated
      + -

    n=0 y=100

    n=1 y=101

    n=1 y=101

  10. Submitted By: shirishareddy — April 9, 2008
    +2 votes
      + -

    The answer for the above program is
    n=0,y=100
    n=1,y=101
    n=1,y=101
    because
    -> For(a)the condition becomes false so ‘0′ will be stored in ‘n’ & y value willnot be changed.
    -> For(b) the condition is becoming true so ‘1′ will be stored in ‘n’.y value will be incremented by ‘1′ i.e y becomes 101.
    ->For(c) the condition is true so ‘1′ will be stored in ‘n’ & y will remain same i.e y=101

  11. Submitted By: chetan kakkar — October 1, 2008
    not yet rated
      + -

    1. n=0, y=100 (n=0 because condition evaluated is false)

    2. n=1,y=101(n=1 because condition evaluated is true and also increment in y)

    3. n=1,y=101.(because condition evaluated is true but nothing change in n and y. both are having their previous values)

  12. Leave an Answer/Comment

    To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
    Click to hear an audio file of the anti-spam word

Our Sponsors
Our Sponsors
Contact Us | FAQ | Sitemap | Terms of Use | Privacy Policy | Tell a Friend

Copyright © 1999-2006 Jeeve Technologies LLC. All rights reserved.