3i Infotech Papers: Sample Questions 1132 - 1134 of 1245

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

Question number: 1132

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

In a header file whether functions are declared or define?

Explanation

Define parts of functions

Define Parts of Functions

Define parts of functions

  • In header files the function are declared not defined it’s defined in the library routines.

  • A header file is a file containing C declarations and macro definitions shared between several source files.

Header file serves two purposes:

  • System header files declare the interfaces to parts of the operating system. Program can include them to supply the declarations needed to invoke system calls. Corresponding libraries providing functionality (definitions) are often linked at run time.

  • Group of related declarations and macro definitions spread across different source files should be combined in a header file.

Question number: 1133

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

Write a program to find the factorial of a number.

Explanation

  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i,f=1,num;
  5.     printf("Enter a number: ");
  6.     scanf("%d",&num);
  7.     for(i=1;i<=num;i++)
  8.     f=f*i;
  9.     printf("Factorial of %d is: %d",num,f);
  10.     return 0;
  11. }

OUTPUT

Enter a number: 8

Factorial of 8 is: =

Question number: 1134

» Languages » Java

Short Answer Question▾

Write in Short

What are virtual functions?

Explanation

  • A virtual function or virtual method is a function or method whose behaviour can be override within an inheriting class using a function with the same signature.

  • Non-static functions are considered as virtual by default unless they are make private or final in java classes.

  • Concept forms an important part of the “polymorphism” in object-oriented programming.