3i Infotech Placement: Sample Questions 167 - 169 of 1245

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

Question 167

Describe in Detail Essay▾

What is late bound function call and early bound function call? Differentiate.

Edit

Explanation

Understanding of Part of Binding
  • All virtual functions have late binding.
  • All non-virtual functions will have early binding.
  • Early binding happens at compile time.
  • Late binding happens at runtime based on type of object referred a by a pointer variable.
  • For example: base class B and derived class D have both implemented a method F () .

    B ⚹ ptr = new D;

    ptr ⇾ F () ;

  • If F () is virtual then D՚s implementation is called.
  • If F () is not virtual than B՚s implementation is called.

Question 168

Write in Short Short Answer▾

How can you get/set an environment variable from a program?

Edit

Explanation

  • An environment variable is accessed using getenv () .
  • And set using the function putenv () .

Question 169

Describe in Detail Essay▾

  1. #include<studio.h>
  2. main ()
  3. {
  4. char s[] ={ ‘a’ ‘b’ ‘c’ ‘’ ‘c’ ‘⧵0’ };
  5. char p, ⚹str, ⚹str1;
  6. p =&s[3];
  7. str =p;
  8. str1 =s;
  9. printf ( “%d” ++ ⚹p ++ +⚹ str1 32);
  10. }
Edit

Explanation

  • In a program
    Table Shows the Program
    char s [] = { ‘a’ ‘b’ ‘c’ ‘’ ‘c’ ‘⧵0’ } ;Given the character array and values
    char ⚹ p, ⚹ str, ⚹ str1;Given three pointer variables
    p = &s [3] ;P is pointing to character ‘’
    str1 = s;Str1 is pointing to character ‘a’
    printf ( “% d” ++ ⚹ p ++ +⚹ str1 − 32) ;
  • ++ ⚹ p , here “p is pointing to ‘’ and that is incremented by one” .
  • The ASCII value of ‘’ is 10, which is then incremented to 11.
  • The value of ++ ⚹ p is 11
  • ++ ⚹ str1 is pointing to ‘a’ that is incremented by 1 and it becomes ‘b’
    • ASCII value of ‘b’ is 98
  • Now performing (11 + 98 - 32) ,
  • We get 77