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?
EditExplanation
- 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.
EditExplanation
#include<stdio.h>
int main()
{
char str1 [20], str[20]
int i=, c=0;
print(“enter first string ::”);
gets(str1);
printf(“enter second string::”);
gets(str2);
printf(“strings are :: ⧵”);
puts(str1);
puts(str2);
while((str1[i]!=’⧵0’) || (str2[i0!=’⧵0’))
{
if (str1[i]!=str2 [i])
c++;
i++;
}
if(c==0)
puts(“⧵strings are equal.”);
else
puts(“strings are not equal.”);
return 0;
}
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▾
#include<studio.h>
main ()
{
int a[2][2][2] ={ { 1, 2, 3, 4}, { 5, 6, 7, 8} };
int ⚹p, ⚹q;
p =&a[2][2][2];
⚹q =⚹ ⚹⚹ a;
printf ( “%d____%d” ⚹p, ⚹q);
}
Explanation
In a 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 |