3i Infotech Papers: Sample Questions 129 - 131 of 1245

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

Question number: 129

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

  1. #define f (gg2g##g2
  2. main ()
  3. {
  4.     int var12 = 100;
  5.     printf ( “%d” f (var12) );
  6. }

Explanation

  • In a program,

    Table showing the program

    Table showing the program

    #define f (g, g2) g##g2

    The ## is a concatenation operator,

    When you pass the two arguments they get concatenated asi/p – > f (g, g2) g##g2o/p – > gg2

    int var12 = 100;

    Define the integer variable var12 = 100

    printf (“%d” f (var, 12) );

    hencef (var, 12) will give us var12effectively the printf statement gets modified as printf (“%d”, f (var, 12) ); – > printf (“%d”, var12);

  • So, the answer is 100

Question number: 130

» Basic CS » Networks

Essay Question▾

Describe in Detail

What is subnet?

Explanation

Structure of subnetting

Structure of Subnetting

Structure of subnetting

  • A subnet is a small network inside a larger network.

  • For example, a large company network with subnets for human resources or accounting.

  • Subnet may represent all the machines at one geographic location, in one building, or on the same local area network.

  • Organization’s network divided into subnets allows connection to the internet with a single shared network address.

  • Without subnets, an organization would require multiple connections to the Internet

  • Subnets properly implemented enhance both the performance and security of network.

Question number: 131

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is class invariant?

Explanation

  • A class invariant is a condition that should be true in all valid states for an object.

  • It is a logical condition to ensure the correct working of a class.

  • Class invariants must hold when an object is created, and they must be preserved under all operations of the class.

  • In particular all class invariants are both preconditions and post-conditions for all operations or member functions of the class.

  • Example: suppose we want to ensure that all point objects x and y coordinates are never negative.

  • We must ensure that a client cannot construct a point object with a negative x or y value.

  • We must ensure that a client cannot move an existing point object to a negative (x, y) location.

Image of the class invariant

Image of the Class Invariant

Image of the class invariant