3i Infotech Placement: Sample Questions 1069 - 1070 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 1069

Edit

Describe in Detail

Essay▾

Differentiate between a for loop and a while loop? What are it uses?

Explanation

Difference between Loop and a While Loop
FOR LoopWHILE Loop
for (initialization; condition; iteration)

{

//body of ‘for’ loop

}

while (condition)

{

Statements; // body of ‘while’ loop

}

For loop runs until the number of predefined iterations are completedWill loop until the condition presented is completed. Condition variables are modified inside the loop
‘For’ loop initialization is never repeated.In while loop if initialization is done during condition checking, then initialization is done each time the loop iterates.

Use of for loop:

  • Used when number of iterations are known beforehand.

Use of while loop:

  • Used when end conditions is known but no idea about the exact number of iterations.

Question 1070

Edit

Describe in Detail

Essay▾

What are conditions for a machine to support Demand Paging?

Explanation

  • The process of mapping a large address space into a relatively small amount of physical memory is known as demand paging.
  • Demand paging is done by implementing ‘backing store’ .

Condition Required for Demand Paging:

  • Page based memory architecture.
  • Restartable instructions supported by the machine.
  • To start process, load the code page where the process will start executing.
  • Process references memory outside of loaded page, bring in as necessary.
  • Only brings page into main memory when a reference is made to a location on the page.
  • The characteristic problem is that there are many page faults when process is first started.

Developed by: