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

Write in Short Short Answer▾

Who were the three famous amigos and their contribution to the object community?

Edit

Explanation

  • The Three amigos namely,
    • James Rumbaugh (OMT) : A veteran analysis with an idea about the objects and their Relationships (Associations) .
    • Grady Booch: A design veteran with the idea about partitioning of systems into subsystems.
    • Ivar Jacobson (Objectory) : The father of USECASES, describing the user and system interaction.

Question 80

Describe in Detail Essay▾

Write a program to compare two strings without using the strcmp () function.

Edit

Explanation

  1. #include<stdio.h>
  2. int main()
  3. {
  4. char str1 [20], str[20]
  5. int i=, c=0;
  6. print(“enter first string ::”);
  7. gets(str1);
  8. printf(“enter second string::”);
  9. gets(str2);
  10. printf(“strings are :: ”);
  11. puts(str1);
  12. puts(str2);
  13. while((str1[i]!=’⧵0’) || (str2[i0!=’⧵0’))
  14. {
  15. if (str1[i]!=str2 [i])
  16. c++;
  17. i++;
  18. }
  19. if(c==0)
  20. puts(“⧵strings are equal.”);
  21. else
  22. puts(“strings are not equal.”);
  23. return 0;
  24. }

OUTPUT

Enter first string:: Abcdef

Enter second string:: ABCDEF

String are::

Abcdef

ABCDEF

These strings are not equal.

Process returned 0.

Question 81

Describe in Detail Essay▾

  1. #include<studio.h>
  2. main ()
  3. {
  4. int a[2][2][2] ={ { 1, 2, 3, 4}, { 5, 6, 7, 8} };
  5. int p, ⚹q;
  6. p =&a[2][2][2];
  7. q =⚹ ⚹⚹ a;
  8. printf ( “%d____%d” ⚹p, ⚹q);
  9. }
Edit

Explanation

In a program

Table Shows the Program
a [2] [2] [2] = { {1,2, 3,4} , {5,6, 7,8} } ;Define the array and it՚s value
int ⚹ p, ⚹ q;Define the 2 integer pointer p and q
p = &a [2] [2] [2] ;You declared only 2D array, but you are trying to access 3D array so, it will print garbage value.
⚹ q =⚹ ⚹⚹ a;Starting address of a

If you print ⚹ q , it will print first element of 3D array (or our 2D array starting address remains the same)

printf ( “% d________ % d” ⚹ p, ⚹ q) ;So, the print is SomeGarbageValue________1