3i Infotech Papers: Sample Questions 659 - 660 of 1245

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

Question number: 659

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is the output of the following program?

  1. main ()
  2. {
  3.     int a = 0;
  4.     int b = 20;
  5.     char x = 1;
  6.     char y = 10;
  7.     if (abxy)
  8.     printf ( “hello” );
  9. }

Explanation

In the program

Table shows the program

Table shows the program

int a = 0;

Define the integer variable a = 0

int b = 20;

Define the integer variable b = 20

char x = 1;

Define the character variable x = 1

char y = 10;

Define the character variable y = 10

if (a, b, x, y)

  • Check if condition.

  • The comma operator has associativity from left to right.

  • Only the rightmost value is returned and the other values are evaluated and ignored.

  • Thus the value of last variable y is returned to check in if.

  • Since it is a non-zero value if becomes true

printf (“hello”);

“hello” will be printed.

Question number: 660

» Basic CS » Operating System

Essay Question▾

Describe in Detail

What is multi-tasking and multi-processing?

Explanation

Multi-tasking:

  • Allows multiple tasks or processes to share common processing resources of CPU.

  • Same as multiprogramming but in a more general meaning- refers to multiple processes (code execution contexts) running at the same time.

  • Used in modern operating systems when multiple tasks share a common processing resource.

  • At any time, CPU is executing one task, other tasks wait their turn.

  • A task in a multitasking operating system is not a whole application program- refers to a thread of execution when one process is divided into sub tasks.

Multi- processing:

  • Refers to multiple processes running at the same time.

  • Confusing since both multi-programming and multitasking describe multiple processes running at the same time.

  • However, multi-programming refers to the CPU units and not running processes- processes are running concurrently on different logical processors or CPU.

  • Multi-programming hardware provides more than one processor.

  • Multitasking system can time-share the single processor