346 views
0 votes
0 votes

Consider the following C program

     

What will be the output of above program ?

1 Answer

2 votes
2 votes

'++' is higher precedence than binary operators.

++p--> it increments value befor execution of the current statement

p++ -->it increments value after the excution of current statement.

s=++p && ++q||r++   // here p and q are pre increments are r is post increment

++p=-2 and ++q=3.

in the AND gate both inputs are TRUE o/p is always 1.

No need of check OR gate because in this gate one i/p is 1 no need of checking 2nd i/p .o/p it is always 1. 

s=1.

t=p+q+s++

t=-2+3+1

t=2 and s=2.

so 2,2 it prints the value.

Related questions

372
views
3 answers
0 votes
Mrityudoot asked Jan 20
372 views
In a max heap of n elements, the time complexity to find 10th largest element is:a)Θ(n log n)b)Θ(n)c)Θ(1)d)Θ(log n) I personally think it should ... can be anywhere in the heap, all the elements need to be traversed once to decide that.
808
views
1 answers
0 votes
atulcse asked Jan 16, 2022
808 views
Consider the following graph:Find the total number of max-heap possible orderings with elements 12, 10, 1, 5, 7, 9, 8 such that each element is filled in ... of the above tree and element 10 occupies only the left child node of its parent.
2.0k
views
5 answers
3 votes
srestha asked May 22, 2019
1,978 views
Consider the following function height, to which pointer to the root node of a binary tree shown below is passedNote that max(a,b) defined by #define max(a ... a:b.int height(Node *root)The output of the above code will be _________________
808
views
1 answers
1 votes
srestha asked May 22, 2019
808 views
A stack based CPU executes the instruction. Memory location $500$ contain $0X 88$ and memory location $700$ contain $0X37$. The stack pointer is at $0X003F$The ... contain $0XBF$ after execution of instruction.$D)$ Both $a)$ and $c)$