Consider the following program in C:
#include <stdio.h>
void func(int i, int j) {
if(i < j) {
int i = 0;
while (i < 10) {
j += 2;
i++;
}
}
printf("%d", i);
}
int main() {
int i = 9, j = 10;
func(i, j);
return 0;
}
The output of the program is _________. (answer in integer)
Note: Assume that the program compiles and runs successfully.
The key idea in this question is variable scope, not arithmetic. main() calls func(9, 10), so inside func the parameter i starts as 9 and parameter j starts as 10.
The check \(i < j\) becomes \(9 < 10\), which is true, so execution enters the inner block of the if statement.
Right at the top of that inner block, the line int i = 0 creates a fresh, independent variable also named i. C allows this because each block has its own scope: this new i exists only from its declaration to the closing brace of the if-block, and while it exists it hides the outer i.
The while loop condition \(i < 10\) and the update \(i++\) inside the loop both operate purely on this fresh inner i, taking it from 0 up to 10; j is also updated 10 times but that has no effect on the printed output. None of this touches the original parameter i sitting outside the block.
Once execution passes the closing brace of the if-block, the inner i disappears since its scope has ended, and the name i reverts to meaning the outer parameter, still holding its original value 9. The printf call after the if-block therefore prints \(i = 9\).
Arrange the following data types available in C language according to their size (smallest to largest):
A. signed long int
B. long double
C. unsigned char
D. unsigned int
Choose the correct answer from the options given below:

Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into the I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is _________ (Answer in integer).
What is printed by the following ANSI C program?
#include<stdio.h>
int main(int argc, char argv[])
{
char a = 'P';
char b = 'x';
char c = (a & b) + '';
char d = (a | b) - '-';
char e = (a ^ b) + '+';
printf("%c %c %c\n", c, d, e);
return 0;
}
ASCII encoding for relevant characters is given below
