3i Infotech Papers: Sample Questions 193 - 195 of 1245

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

Question number: 193

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

  1. #define square (xx * x
  2. main ()
  3. {
  4.     int i;
  5.     i = 64/square (4);
  6.     printf ( “%d” i);
  7. }

Explanation

In a program

Table shows the program

Table shows the program

int i;

Define integer variable i

i = 64/square (4);

macro call square (4) will substituted by 4 * 4so the expression becomes i = 64/4 * 4.

Since/and * has equal priority the expression will be evaluated as (64/4) *4

i. e. 16 * 4=64

printf (“%d” i);

Print the value of i is 64

Question number: 194

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is a node class?

Explanation

A node class is a class that has added new services or functionality beyond the services inherited from its base class.

A node class:

  • Relies on the base class for services and implementation,

  • Provides a wider interface to the users than its base class

  • Relies primarily on virtual functions in its public interface

  • Depends on all its direct and indirect base class

  • Can be understood only in the context of the base class

  • Can be used as base for further derivation

  • Can be used to create objects.

Image of the node class

Image of the Node Class

Define the image is node class code.

Question number: 195

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

  1. main ()
  2. {
  3.     extern int i;
  4.     i = 20;
  5.     printf ( “%d” i);
  6. }

Explanation

  • In a program extern storage class in the following declaration

  • Here, given extern int i;

  • Specifies to the compiler that the memory for i is allocated in some other program.

  • That address will be given to the current program at the time of linking.

  • However, linker finds that no other variable of name i is available in any other program with memory space allocated for it.

  • So, a linker error has occurred.