Languages [TCS Placement]: Sample Questions 37 - 38 of 131

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 37

Edit

Write in Short

Short Answer▾

Why is it that not all header files are declared in every C program?

Explanation

  • The choice of declaring a header file at the top of each C program would depend on what commands or functions used in that program.
  • Since each header file contains different function definitions and prototype, only use those header files that contain the needed functions.
  • Declaring all header files in every program would increase the overall file size and load of the program, and is not a good programming style.

Question 38

Question

MCQ▾

How many types of polymorphisms are supported by c ++ ?

Choices

Choice (4)

a.

3

b.

1

c.

4

d.

2

Answer

d.

Explanation

  • Polymorphism provides ability to use an operator or function in different ways- providing different meanings to the operators or functions depending on context.
  • C ++ provides two different types of polymorphism.
    • run-time
    • compile-time
  • run-time:
    • The appropriate member function is selected while the program is running.
    • Run-time polymorphism is implemented with inheritance and virtual functions.
  • Compile-time:
    • Compiler is able to select the appropriate function for a particular call at compile-time.
    • Compile-time polymorphism is implemented with templates.
Given the Image is Define the Types of Polymorphisms

Developed by: