Basic CS-Data Structures [3i Infotech Placement]: Sample Questions 23 - 24 of 52

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

Question 23

Data Structures

Question

MCQ▾

Under which circumstance should you create an index on a table?

Choices

Choice (4)

a.

The table is small.

b.

The table is updated frequently.

c.

A columns values are static and contain a narrow range of values

d.

Two columns are consistently used in the WHERE clause join condition of SELECT statements.

Answer

d.

Explanation

  • Index on table is created when there are thousands of rows and user wants to search the record on some conditions.
  • So indexes are created for where clauses- for columns used in the WHERE clauses or join conditions.
  • Creating an index on an empty table has no performance implications at the time of creation but performance is affected when data is added to the table.
  • Creating indexes on large tables should be planned to not affect database performance.
  • Preferred way to create indexes on large tables is to start with the clustered index and then build no clustered indexes.
  • Set the ONLINE option to ON when creating indexes on existing tables.

Question 24

Data Structures

Question

MCQ▾

You are creating a Index on EMPNO column in the EMPLOYEE table. Which statement will you use?

Choices

Choice (4)

a.

CREATE INDEX emp_empno_idx FOR employee, empno

b.

CREATE INDEX emp_empno_idx ON employee, empno

c.

CREATE INDEX emp_empno_idx ON employee (empno)

d.

CREATE emp_empno_idx INDEX ON employee (empno)

Answer

c.

Explanation

CREATE INDEX emp_empno_idx ON employee (empno) statement creates a Index on EMPNO column in the EMPLOYEE table.

Developed by: