Wednesday 2 September 2015

C language Questions

1) Consider following Dumbo programming code


   i.  Use locations A, B;
  ii.  Output "Give A and B: ";
 iii.  A = 77; 
  iv.  B = 209;
   v.  B = A + B;
  vi.  A = A + B;
 vii.  Output A;
viii.  Output B
 
What value will be printed by the statement 'Output A' ?

2)What is the integer equivalent represented by 2's complement -
of the binary number 10011100?
 
3)Consider following code 
 int main() {
    int d = 24;
    int m = 10;
    int y = 2940;
    int c = 0;
    int val;
    val = ( d + m + y + (y/4) + c) % 7;
    cout << val;
    return 0;
}   
What value will be printed by the statement 'cout << val'?
 
4)Consider following Code
 
int main() { 
    int a = 4;
    int b = 6;
    int lamp, light;
 
    lamp = 5*a + 2*b;
    light = 4*a + 8*b;
 
    while(lamp < light) {
        lamp = lamp + 4;
        light = light - 2;
    }
    return 0;
}  

No comments:

Post a Comment