3i Infotech Papers: Sample Questions 552 - 553 of 1245

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

Question number: 552

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

  1. main ()
  2. {
  3.     int c[ ] = { 2.83.446.75};
  4.     int j,
  5.     p = c,
  6.     q = c;
  7.     for (j = 0j<5j + + )
  8.     {
  9.         printf ( “%d” * c);
  10.         + + q;
  11.     }
  12.     for (j = 0j<5j + + )
  13.     {
  14.         printf ( “%d” * p);
  15.         + + p;
  16.     }
  17. }

Explanation

  • In a program

  • int c [] = {2.8,3.4,4, 6.7,5} in array was integer so can not indicate preceding value

Table shows the program

Table shows the program

int c [] = {2.8,3.4,4, 6.7,5}

Integer value array

int j

Integer variable

* p = c,

* q = c

Pointer C is assigned to both p and q

for (j = 0; j < 5; j ++)

{

printf (“%d” * c);

++ q;

}

In a first loop, q is incremented and not c

So, the value 2 will be printed 5 times

for (j = 0; j < 5; j ++)

{

printf (“%d” * p);

++ p;

}

In a second loop p itself is incremented

So, the values 23465 will be printed

  • So the final answer is 2 2 2 2 2 2 3 4 6 5.

Question number: 553

» Basic CS » Operating System

Essay Question▾

Describe in Detail

Explain the popular multiprocessor thread-scheduling strategies.

Explanation

Load sharing:

Image of the load sharing

Image of the Load Sharing

Image of the load sharing

  • Processes are not assigned to particular processor.

  • A global queue of threads is maintained- a thread from this queue is selected for running.

  • Load balancing allocates work to processor on a permanent basis.

Gang scheduling:

Understanding of gang scheduling

Understanding of Gang Scheduling

Understanding of gang scheduling

  • Allows a set of related threads to run on a set of processor at the same time- on 1 to 1 basis.

  • Closely related threads may be scheduled on same processor reducing synchronization blocking and minimizing process switching.

  • Group scheduling predated this strategy.

Dedicated Processor Assignment:

Dedicated Processor Assignment

Dedicated Processor Assignment

Dedicated Processor Assignment

  • When application is scheduled, its threads are assigned to a processor that remains dedicated to it.

  • Some processors may remain idle.

  • No multiprogramming of processors.

Dynamic Scheduling:

  • Number of threads in a process are altered dynamically by the application.

  • Operating system adjusts the load to improve utilization.