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

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What are the main differences between procedure oriented languages and object oriented language?

Explanation

Procedure Oriented Languages and Object Oriented Language
Procedure oriented languageObject oriented language
Divided into small parts called functionsDivided into parts called objects.
Follows top down approach.Follows bottom up approach.
Does not have any access specifiers.Access specifiers are named public, private, protected, etc.
Adding new data and function is not easy.Provide an easy way to add new data and function.
Overloading is not possible.Overloading is possible in the form of function overloading and operator overloading
Example: C, VB, FORTRAN, Pascal.Example: C ++ , JAVA, VB. NET, C#. NET.

Question 210

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is the output of the following program?

  1. main ()
  2. {
  3.     char ⚹p;
  4.     int ⚹q;
  5.     long ⚹r;
  6.     p =q =r =0;
  7.     p ++;
  8.     q ++;
  9.     r ++;
  10.     printf ( “%p…%p…%p” p, q, r);
  11. }

Explanation

  • In the program
Table Shows the Program
char ⚹ p;

int ⚹ q;

long ⚹ r;

Declare the character pointer p, integer pointer q and long pointer r.
p = q = r = 0;Define the p, q and r as 0
p ++ ;

q ++ ;

r ++ ;

Increment the value of p , q and r
printf ( “% p … % p … % p” p, q, r) ;++ operator when applied to pointers increments address according to their corresponding data-types.
  • So the answer is p = 0001, q = 0002 and r = 0004
  • % p print out a pointer, specifically the address to which the pointer refers, and since it is printing out a part computer՚s architecture, it does so in hexadecimal.

Developed by: