Languages [3i Infotech Placement]: Sample Questions 5 - 6 of 546

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 5

Question

MCQ▾

In the following code segment what will be the result of the function value of x, value of y

  1. {
  2.     unsignedintx =-1;
  3.     inty;
  4.     y =~0;
  5.     if (x == y)
  6.     printf ( “same” );
  7.     else
  8.     printf ( “notsame” );
  9. }

Choices

Choice (4)

a.

Not same

b.

Same, MAXUNIT, MAXUNIT

c.

Same

d.

Not same, MAXINT

Answer

c.

Explanation

  • In the program
Table Showing the Program
unsigned int x =-1;
  • define the unsigned integer variable x =-1
int y;
  • define the integer variable y
y = ~0;
  • ~0 is the binary representation of -1
  1. if (x == y)
  2. printf ( “same” );
  3. else
  4. printf ( “notsame” );
  5. }
  • Check the if condition
  1. if (-1 == -1)
  2. printf ( “same” );
  3. else
  4. printf ( “notsame” );
  5. }
  • So the answer is same

Question 6

Languages

Question

MCQ▾

Without the use of Cartesian product, how many joining conditions are required to join tables?

Choices

Choice (4)

a.

1

b.

3

c.

4

d.

2

Answer

b.

Explanation

  • To join ‘n’ tables ‘n-1’ conditions should be satisfied so to join tables conditions should be satisfied.
  • Join is used to collate data from two more tables- joined to appear as single table of data.
  • Combines columns from two or more tables by using values common to both table.
  • “Join” keyword is used in SQL queries for joining two or more tables.
  • Minimum required condition for joining table is (n-1) where n, is number of tables.
  • A table can also join to itself, which is known as self join.

Developed by: