3i Infotech Papers: Sample Questions 405 - 407 of 1245

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

Question number: 405

» Basic CS » Data Structures

Essay Question▾

Describe in Detail

How many different trees are possible with 10 nodes?

Explanation

1014 different trees are possible with 10 nodes?

Consider a tree with 3 nodes (n = 3)

Maximum combination has 5 different (i. e, ) trees.

Five different trees

Five Different Trees

Five different trees

If n node, there exist different trees.

Question number: 406

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

What is the output of the following program?

  1. main ()
  2. {
  3.     char not;
  4.     not =! 2;
  5.     printf ( “%d” not);
  6. }

Explanation

In a program

Table shows the program

Table shows the program

char not;

Given the character variable

not =! 2;

  • ! Is a logical operator.

  • In C the value 0 is considered to be the Boolean value FALSE, and any non-zero value is considered to be the Boolean value TRUE.

  • Here 2 is a non-zero value so TRUE.

  • ! TRUE is FALSE (0)

printf (“%d” not);

This prints 0.

Question number: 407

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is the output of the following program?

  1. main ()
  2. {
  3.     float f = 5g = 10;
  4.     enum { i = 10j = 20k = 50};
  5.     printf ( “%d ” + + k);
  6.     printf ( “%f ” f<<2);
  7.     printf ( “%lf ” f%g);
  8.     printf ( “%lf ” fmod (fg) );
  9. }

Explanation

Line no 5: Error: L value required

Line no 6: Cannot apply leftshift to float

Line no 7: Cannot apply mod to float

In the program

Table shows the program

Table shows the program

float f = 5, g = 10;

  • Define the floating variable f and g and value is 5 and 10 continue

enum {i = 10, j = 20, k = 50};

  • Define the enumeration constants

printf (“%d ” ++ k);

  • Enumeration constants cannot be modified, so you cannot apply ++.

printf (“%f ” f < < 2);

printf (“%lf ” f % g);

  • Bit-wise operators and % operators cannot be applied on float values.

printf (“%lf ” fmod (f, g) );

  • fmod () is to find the modulus values for floats as % operator is for ints.

 Lvalues and Rvalues in image

Lvalues and Rvalues in Image

Lvalues and Rvalues in image