3i Infotech Papers: Sample Questions 666 - 667 of 1245

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

Question number: 666

» Basic CS » Operating System

Essay Question▾

Describe in Detail

How to do inter-process communication?

Explanation

  • Inter-process communication or IPC allows exchange of data between processes.

  • Provides a set of programming interfaces to help programmer organize the activities among different processes.

Two types of inter process communication:

  • Independent process

    • An independent process is not affected by the execution of other processes.

  • Co-operating process

    • A co-operating process can be affected by other executing processes.

Two types of inter process communication

Two Types of Inter Process Communication

Two types of inter process communication

  • The communication between these processes allows co-operation between them.

Process communicates with each other using these two ways:

  • Shared Memory

  • Message passing

Process communicates with each other using these two ways

Process Communicates with Each Other Using These Two Ways

Process communicates with each other using these two ways

Question number: 667

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is the output of the following program?

  1. #define max 5
  2. #define int arr1[max]
  3. main ()
  4. {
  5.     typedef char arr2[max];
  6.     arr1 list = { 01234};
  7.     arr2 name = “name”;
  8.     printf ( “%d %s” list[0], name);
  9. }

Explanation

  • Compiler error (in the line arr1 list= {0,1, 2,3, 4} )
  • In a program

Table shows the program

Table shows the program

#define max 5

Define the pre declaration max = 5

#define int arr1 [max]

Also define integer arr1 [max]

typedef char arr2 [max];

  • arr2 is declared of type array of size 5 characters.

  • So it can be used to declare the variable name of the type arr2.

  • But same is not the case with arr1 (arr1 list = {0,1, 2,3, 4}; )

  • Hence an error

  • #defines are used for textual replacement whereas typedefs are used for declaring new types.