Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 231 - 233 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 231

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is Dynamic polymorphism?

Explanation

Understanding Types of Polymorphism
  • An entity changing its form depending on the circumstances is said to have dynamic polymorphism
  • A function is said to exhibit dynamic polymorphism when it exists in more than one form.
  • Its various forms are resolved dynamically when the program is executed.
  • Late binding refers to the resolution of the functions at run-time instead of compile time.
  • Flexibility is thus given to the program by allowing the appropriate method to be invoked, depending on the context.

Question 232

C & C Plus Plus
Edit

Describe in Detail

Essay▾
  1. voidmain ()
  2. {
  3.     inti =5;
  4.     printf( “%d” i ++ ++ +i);
  5. }

Explanation

  • In a program
Table Shows the Program
int i = 5;Given the integer i = 5
printf ( “% d” i ++ ++ + i) ;Here given the i ++ ++ + i

If it is i ++ ++ + i the output will be 12

Because i ++ = 6

++ i = 6

6 + 6 = 12

But in this case continuous five plus will show error

Compiler cannot identify operands there must be a space in between

  • So the expression i ++ ++ + I is parsed as i ++ ++ + I which is an illegal combination of operators.

Question 233

C & C Plus Plus
Edit

Write in Short

Short Answer▾
  1. main ()
  2. {
  3.     inti =10;
  4.     i =! i>14;
  5.     Printf ( “i =%d” i);
  6. }

Explanation

In a program

Table Shows the Program
int i = 10;Integer variable i = 10
i = ! i > 14;NOT (!) operator has precedence over ‘>’ symbol.

! is a unary logical operator

! i (! 10) is 0 (not of true is false) .

0 > 14 is false (zero) .

Printf ( “i =% d” i) ;Print “i = 0”

Developed by: