Question
What will be the output of the following C code?
#include < stdio.h > void main ( ) { int x = 10, y = 20, *p1 = &x, *p2 = &y; *p2 = *p1 + *p2; printf ("%d %d\n", x, y); }Solution
The code demonstrates pointer manipulation in C. Here’s a breakdown: • int x = 10, y = 20; declares two integers, x and y. • *p1 = &x, *p2 = &y; initializes p1 to point to x and p2 to point to y. • *p2 = *p1 + *p2; fetches the values of x and y through p1 and p2 respectively, adds them, and assigns the result back to y via *p2. After this operation, y becomes 30, while x remains 10. Output: 10 30. Why Other Options Are Incorrect: 1. 10 20: This would occur if no pointer manipulation happened, but the code modifies y. 2. 30 10: Only y is updated, not x. 3. Compiler error: The code is syntactically correct and compiles successfully. 4. Undefined behavior: The pointers are used properly with valid memory addresses, avoiding undefined behavior.
- What is the maximum aggregate withdrawal limit for a small account per month where KYC is not completed ? 
- At 31 Mar, management projects a worst-case stress showing net technical provisions plus URR exceed current solvency margin by 10%. Regulator requires p... 
- A bank has statutory reserve requirement of 25% of Net Profit before appropriations. Net Profit before appropriations = ₹40 crore. Transfer to reserve... 
- Which portal monitors outstanding dues to MSEs? 
- A customer reports unauthorized transactions on their digital banking app. Under RBI’s directions, if the customer informs the bank within 3 days, wha... 
- As per Schedule I, any kind of disposal or transfer of business assets made by an entity on a permanent basis qualifies as supply, even though it is wit... 
- Who is responsible for ensuring compliance with the obligations imposed under Chapter IV of the PML Act and for reporting to the Financial Intelligence ... 
- A borrower has defaulted on a term loan for over 90 days. The bank categorizes the account as an NPA. Later, the borrower partially repays the overdue a... 
- A bank’s Profit before appropriations = ₹20 crore. Statutory reserve requirement is 25%. The bank also transfers ₹2 crore to Investment Fluctuatio... 
- A bank finds it difficult to repay the short term deposits on maturity because the funds of the bank are locked in ____