3i Infotech Placement: Sample Questions 425 - 426 of 1245

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

Question 425

Question

MCQ▾

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

Choices

Choice (4)

a.

won՚t

b.

Will

c.

All of the above

d.

None of the above

Answer

a.

Explanation

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 426

Edit

Write in Short

Short Answer▾

What is the output of the following program?

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

Explanation

Behavior is implementation dependent.

In 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.

Developed by: