3i Infotech Papers: Sample Questions 675 - 676 of 1245

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

Question number: 675

» Basic CS » Operating System

Essay Question▾

Describe in Detail

What is paging vs. swapping?

Explanation

Structure of paging.

Structure of Paging.

Structure of paging.

Structure of swapping

Structure of Swapping

Structure of swapping

Difference between Swapping and Paging

Difference between Swapping and Paging

Swapping

Paging

Moving the entire non-running process with all data from main memory used by other processes.

Dividing the whole process memory into pages and the memory into frame.

Moving entire address spaces between disk and memory.

Moves individual pages only between disk and memory, so part of an address space is on disk while other part is in main memory.

Swapping is less flexible.

Paging is more flexible.

Allows more processes to reside in main memory

Allows less processes to reside in main memory.

Question number: 676

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is the output of the following program?

  1. main ()
  2. {
  3.     int i = 4j = 7;
  4.     j = j|| i + + && printf ( “YOU CAN” );
  5.     printf ( “%d %d”, ij);
  6. }

Explanation

In the program

Table shows the program

Table shows the program

int i = 4, j = 7;

  • Given the integer variable i = 4 and j = 7

j = j|| i ++ && printf (“YOU CAN”);

  • The boolean expression needs to be evaluated only till the truth value of the expression is not known.

  • J is not equal to zero itself means that the expression’s truth value is 1.

  • Because it is followed by|| and true|| (anything) = > true, thus (anything) will not be evaluated. So the remaining expression is not evaluated and so the value of I remains the same.

  • Similarly when && operator is involved in an expression, it becomes false any of the operands become false- the whole expression’s truth value becomes false and hence the remaining expression is notevaluated. Thus, false && (anything) = > false where (anything) will not be evaluated.

printf (“%d % d”, i, j);

printf prints the value of i = 4 and j = 1