Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 191 - 193 of 354

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

Question 191

C & C Plus Plus
Edit

Write in Short

Short Answer▾
  1. voidmain()
  2. {
  3.     inti=7;
  4.     printf("%d",i++⚹i++);
  5. }

Explanation

Table Showing the Program
int i = 7;
  • define the integer variable i as 7
printf ( “% d” , i ++ ⚹ i ++) ;
  • printf prints the (i ++ ⚹ i ++) equation value
  • = i ++ ⚹ i ++
= 7 ++ ⚹ 7 ++

= 8 ⚹ 7

= 56

Question 192

C & C Plus Plus
Edit

Write in Short

Short Answer▾

What is the output of the following program?

  1. main ()
  2. {
  3.     inta[10];
  4.     printf ( “%d” ⚹a +1-⚹ a +3);
  5. }

Explanation

In the program

Table Shows the Program
int a [10] ;Define the integer array a [10]
printf ( “% d” ⚹ a + 1-⚹ a + 3) ;Here ⚹ a and -⚹ a cancel out.

The result is as simple 1 + 3 = 4

Question 193

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What do you mean by multiple inheritance and multilevel inheritance? Differentiate between them.

Explanation

Multiple Inheritances:

Define Multiple Inheritance
  • A class can inherit from more than one classes.
  • More than one parent classes
  • This is not parent in java.
  • Example: two class A and B as the parent classes of class C, then we define C as follows.

class C: public A, public B

{

//code

} ;

Multilevel Inheritance:

Understanding of Multilevel Inheritance
  • Class having more than level of parent classes produces multilevel inheritance.
  • The level of inheritance depends on the relation- similar to relation between grandfather, father and child.
  • Example:

class A

{

} ;

class B: public A

{

} ;

Class c: public B

{

} ;

Developed by: