# 3i Infotech Papers: Sample Questions 596 - 597 of 1245

Examrace Placement Series prepares you for the toughest placement exams to top companies.

## Question number: 596

Essay Question▾

### Describe in Detail

What is the output of the following program?

1. `main ()`
2. `{`
3. `    void swap ();`
4. `    int x = 10, y = 8;`
5. `    swap (&x, &y);`
6. `    printf ( “x = %d y = %d”, x, y);`
7. `}`
8. `void swap ()`
9. `int * a, int * b`
10. `{`
11. `    *a^=*b,*b^=*a,*a^=*b;`
12. `}`

### Explanation

In the program using ^ swaps two variables without using a temporary variable and that too in a single statement.

 void swap (); Swap is a function Take any number of arguments and returns nothing. int x = 10, y = 8; Define integer variable x = 10 and y = 8 swap (&x, &y); Call swap (&x, &y); that has two arguments. printf (“x =%d y =%d”, x, y); printf prints the swapping value of x and y Modern style of declaration: void swap (int * a, int * b) { *a^=*b, *b^=*a, *a^=*b; } void swap () int * a, int * b { *a^=*b, *b^=*a, *a^=*b; } This convention is historic pre-ANSI style (referred to as Kernighan and Ritchie style) style of function declaration. Swap function is defined with arguments following the (). So the declaration for swap looks void swap () which means the swap can take any number of arguments.

## Question number: 597

Essay Question▾

### Describe in Detail

What is time-stamping?