3i Infotech Papers: Sample Questions 603 - 604 of 1245

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

Question number: 603

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is the output of the following program?

  1. main ()
  2. {
  3.     int a = 2, * f1, * f2;
  4.     f1 = f2 = &a;
  5.     f2 + = * f2 + = a + = 2.5;
  6.     printf ( “  %d %d %d”, a, * f1, * f2);
  7. }

Explanation

In the program

Table shows the program

Table shows the program

int a = 2, * f1, * f2;

  • Given the integer variable a = 2 and pointer variable f1 and f2.

f1 = f2 = &a;

  • f1 and f2 both refer to the same memory location a.

* f2 += * f2 += a += 2.5;

*f2=*f2+ (*f=*f2+ (a = a+2.5) )

a = a+2.5 = 4

so * f2 = 4

*f2=*f2 + 4=8

Now * f2 = 8

So, *f2=*f2 + 8=16

printf (“ % d %d % d”, a, * f1, * f2);

So changes through f1 and f2 ultimately affects only the value of a.

So the answer is 16 16 16

Question number: 604

» Database » MySQL

Essay Question▾

Describe in Detail

What are partial, alternate, artificial, compound and natural key?

Explanation

Partial key:

  • It is a set of attributes that can uniquely identify weak entities related to same owner entity. It is sometime called as Discriminator.

    Alternate key:

  • All Candidate Keys excluding the Primary Key are known as Alternate Keys.

Artificial key:

  • If no obvious key, either stand-alone or compound is available, then the last resort is to simply create a key, by assigning a unique number to each record or occurrence. Then this is known as developing an artificial key.

Compound Key:

  • If no single data element uniquely identifies occurrences within a construct, then combining multiple elements to create a unique identifier for the construct is known as creating a compound key.

Natural Key:

  • When one of the data elements stored within a construct is utilized as the primary key, then it is called the natural key.