3i Infotech Papers: Sample Questions 357 - 358 of 1245

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

Question number: 357

» Database » Oracle

MCQ▾

Question

If an UNIQUE KEY constraint on DATE column is created, will it accept the rows that are inserted with SYSDATE?

Choices

Choice (4) Response

a.

Will

b.

Won’t

c.

None of the above

d.

Question does not provide sufficient data or is vague

Answer

b.

Explanation

UNIQUE KEY and Primary key constrain

UNIQUE KEY and Primary Key Constrain

UNIQUE KEY and Primary key constrain

  • If an UNIQUE KEY constraint on DATE column is created, it won’t accept the rows that are inserted with SYSDATE.

  • A unique key defined on a column which has date as the data type- then one cannot insert the same date more than once.

  • A SYSDATE has certain resolution, rows inserted more frequently will come out with same value for the date column and hence would fail.

SYSDATE

Syntax:

SYSDATE

Parameter:

The function requires no parameters.

Example:

SELECT TO_CHAR

(SYSDATE, ‘MM-DD-YYYY HH24: MI: SS’) “NOW”

FROM DUAL;

O/P

08 - 12 - 2005 09: 45: 51

Question number: 358

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

What is the output of the following program?

  1. main ()
  2. {
  3.     char i = 0;
  4.     for (; i> = 0i + + );
  5.     printf ( “%d ” i);
  6. }

Explanation

Behavior is implementation dependent.

In the program

Table shows the program

Table shows the program

{

char i = 0;

for (; i > = 0; i ++);

printf (“%d ” i);

}

  • If the char is signed or unsigned by default is implementation dependent.

  • If the implementation treats the char to be signed by default the program will print –128 and terminate.

  • On the other hand if it considers char to be unsigned by default, it goes to infinite loop.

Rule: You can write programs that have implementation dependent behavior. But don’t write programs that depend on such behavior.