3i Infotech Papers: Sample Questions 554 - 555 of 1245

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

Question number: 554

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

  1. main ()
  2. {
  3.     static int var = 5;
  4.     printf ( “%d” var--);
  5.     if (var)
  6.     main ();
  7. }

Explanation

  • In a program

Table shows the program

Table shows the program

static int var = 5

Given static storage class

printf (“%d” var–)

Change the value of a static variable

if (var)

Check the variable is available or not

main ();

Main is also treated like any other ordinary function, which can be called recursively

  • So, the first time static int var = 5.

  • Than print 5 and decrease the value, and check var are available or not

  • Var are available go to the main () function

  • Same process are continuously when var value was empty

  • So, the answer is 5 4 3 2 1.

Question number: 555

» Database » MySQL

Appeared in Year: 2006

Essay Question▾

Describe in Detail

How functional dependency is related to database table design?

Explanation

  • Normalization is the technique of breaking the complex tables into much understandable smaller one to improve the optimization of the database structure.

  • The concept of “Functional Dependency” is followed in Second Normal Form (2NF) which means all the columns in the schema should be functionally dependent on the primary key of that schema.

  • All the columns in the tables should have a relationship with the main key. In this situation, all the columns are functionally dependent.

  • Say for example, if you have an Employee table that has Empno, Ename, Salry columns.

  • Here empno is the main key.

  • Ename refers employee name and salary refers employee salary.

  • Those are functionally dependent on Empno.

  • If you include InvoiceNo in this table, it is irrelevant and it is not functionally dependent on Empno.

  • As per Second Normal Form (2NF), all the non-functionally dependent columns to be removed from the schema and applied to the new table to increase the performance of the database.