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

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is the output of the following program?

  1. voidmain ()
  2. {
  3.     chara[] =“12345⧵0” ;
  4.     inti =strlen (a);
  5.     printf ( “herein3 %d” ++ i);
  6. }

Explanation

Here in 3 6

In the program

Table Shows the Program
char a [] = “12345⧵0” ;The char array ‘a’ will hold the initialized string whose length is counted from 1 till the null character.
int i = strlen (a) ;The ‘i’ will hold the value equal to 5.
printf ( “here in 3 % d” ++ i) ;The pre-increment in the printf statement will print 6.
In this Image Define the Strlen () Function How to Use in C

Question 240

C & C Plus Plus
Edit

Write in Short

Short Answer▾

List out some of the object-oriented methodologies.

Explanation

  • Object Oriented Development (OOD) (Booch 1991,1994) .
  • Object Oriented Analysis and Design (OOA/D) (Coad and Yourdon 1991) .
  • Object Modeling Techniques (OMT) (Rumbaugh 1991) .
  • Object Oriented Software Engineering (Objectory) (Jacobson 1992) .
  • Object Oriented Analysis (OOA) (Shlaer and Mellor 1992) .
  • The Fusion Method (Coleman 1991) .

Question 241

C & C Plus Plus

Question

MCQ▾

What is output for the following program.

  1. #include
  2. main ()
  3. {
  4.     inta[5], i, ⚹ip;
  5.     for (i =0; i<5; i ++ )
  6.     a[i] =i;
  7.     ip =a;
  8.     printf ( “%d” ⚹(ip +3 ⚹sizeof (int) ) );
  9. }

Choices

Choice (4)

a.

5

b.

1

c.

0

d.

None of the above

Answer

d.

Explanation

Table Showing the Program
#include < tdio. h >Standard library function
main ()startup after initialization
int a [5] , i, ⚹ ip;Declare integer array of 5, integer i and ⚹ ip is pointer to an integer
for (i = 0; i < 5; i ++)In for loop increase value of i
a [i] = i;

ip = a;

Array element i is equal to i and ip = a, that is the beginning of the array. Array name is the pointer to first element in the array
printf ( “% d” ⚹ (ip + 3 ⚹ sizeof (int) ) ) ;This would print 3rd value in the array a [] which is 3.

Developed by: