Searching for "Swap"

Q:

Indicate what would the SWAP macro be expanded to on preprocessing. Would the code compile?

#define SWAP (a, b, c ) (c t; t = a, a = b, b = t; )

main()

{

    int x = 10, y = 20;

    SWAP (x, y, int );

    printf ( " %d%d ", x, y);

}

Answer

( int t ; t = a, a = b, b = t ;);


This code won't compile since declaration of t cannot occur within parentheses.


 

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

Q:

Swap two variables without using third variable.

Answer

#include<stdio.h>
int main(){
    int a=5,b=10;
    a=b+a;
    b=a-b;
    a=a-b;
    printf("a= %d  b=  %d",a,b);
}

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

Q:

What scheme does the Kernel in Unix System V follow while choosing a swap device among the multiple swap devices?

Answer

Kernel follows Round Robin scheme choosing a swap device among the multiple swap devices in Unix System V.

Report Error

View answer Workspace Report Error Discuss

Subject: Operating Systems Exam Prep: GATE

Q:

A Map is an Array,which contains the addresses of the free space in swap device that are allocatable resources,and the number of the resource unit available there.

A) TRUE B) FALSE
Answer & Explanation Answer: A) TRUE

Explanation:

The given statement is clearly true.

Report Error

View Answer Workspace Report Error Discuss

Subject: Operating Systems
Exam Prep: GRE

Q:

Which among the following are not the children of Swapper or Scheduler?

A) Process Dispatcher B) Vhand
C) Dbflush D) All the above
 
Answer & Explanation Answer: D) All the above

Explanation:

Process Dispatcher,Vhand,Dbflush are the children of Scheduler

Report Error

View Answer Report Error Discuss

Filed Under: Operating Systems
Exam Prep: GATE