Languages [3i Infotech Placement]: Sample Questions 336 - 337 of 546

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

Question 336

Describe in Detail

Essay▾

What method is used in Win in multitasking?

Explanation

  • Windows had non-pre-emptive scheduling till Windows , after which it changed to pre-emptive from Windows .
  • In non-pre-emptive scheduling, a task runs until it stops (voluntarily) , or finishes.
    • The Scheduler then checks all tasks՚ states and schedules the next highest priority task in ready state.
    • In non-pre-emptive scheduling a task assigned to the CPU, cannot be taken away, even if short tasks have to wait.
    • In non-pre-emptive scheduling each task gets its՚ share of the CPU, avoiding delay in the task.
    • The ‘amount of time’ allocated to the CPU may not necessarily be equal, as it depends on how long the task takes to complete.
  • In pre-emptive scheduling, a task waiting for other resources is pre-emptively put to wait state and other ready task is scheduled.

Question 337

Edit

Describe in Detail

Essay▾

What is the output of the following program?

  1. main ()
  2. {
  3.     char ⚹p;
  4.     int ⚹q;
  5.     long ⚹r;
  6.     p =q =r =0;
  7.     p ++;
  8.     q ++;
  9.     r ++;
  10.     printf ( “%p…%p…%p” p, q, r);
  11. }

Explanation

  • In the program
Table Shows the Program
char ⚹ p;

int ⚹ q;

long ⚹ r;

Declare the character pointer p, integer pointer q and long pointer r.
p = q = r = 0;Define the p, q and r as 0
p ++ ;

q ++ ;

r ++ ;

Increment the value of p , q and r
printf ( “% p … % p … % p” p, q, r) ;++ operator when applied to pointers increments address according to their corresponding data-types.
  • So the answer is p = 0001, q = 0002 and r = 0004
  • % p print out a pointer, specifically the address to which the pointer refers, and since it is printing out a part computer՚s architecture, it does so in hexadecimal.

Developed by: