Basic CS-Data Structures [3i Infotech Placement]: Sample Questions 4 - 5 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 4

Data Structures

Question

MCQ▾

Which Statement would you use to remove the EMPLOYEE_Id_PK PRIMARY KEY constraint and all depending constraints from the employee table?

Choices

Choice (4)

a.

ALTER TABLE employee DROP PRIMARY KEY CASCADE

b.

MODIFY TABLE employee DELETE PRIMARY KEY employee_id_pk CASCADE

c.

MODIFY TABLE employee DROP CONSTRAINT employee_id_pk CASCADE

d.

ALTER TABLE employee DROP PRIMARY KEY employee_id_pk CASCADE

Answer

a.

Explanation

ALTER TABLE employee DROP PRIMARY KEY CASCADE removes the EMPLOYEE _ID_PKPRIMARY KEY constraint and all depending constraints from the EMPLOYEE table.

Question 5

Data Structures
Edit

Describe in Detail

Essay▾

There are 8, 15,13, 14 nodes in 4 different trees. Which of them could form a full binary tree?

Explanation

  • There are 8, 15,13, 14 nodes in 4 different trees- of these tree with 15 nodes could be a full binary tree.
  • There are 2n-1 nodes in a full binary tree.

Method of Elimination

  • Full binary trees contain odd number of nodes- 8 and 14 nodes cannot be full binary trees.
  • 13 nodes can form a complete binary tree but not a full binary tree.
  • So, 15 nodes is a correct answer.

Bellow given full binary tree and complete binary tree:

Full Binary Tree and Complete Binary Tree
  • A complete Binary Tree has all levels completely filled except possibly the last level and the last level has all keys towards as much to the left as possible.
  • All full binary trees are complete binary trees, but all complete binary trees are not full binary trees.

Developed by: