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

C & C Plus Plus
Edit

### Describe in Detail

Essay▾
1. `#include<stdio.h>`
2. `#define MAX(x,y) (x)>(y)?(x):(y)`
3. `int main()`
4. `{`
5. `    int i=10;`
6. `    int j=5;`
7. `    int k=0;`
8. `    k=MAX(i,j);`
9. `    printf("%d %d %d",i,j,k);`
10. `}`

### Explanation

• In the program
 #define MAX (x, y) (x) > (y) ? (x) : (y) define the MAX () functionFind the maximum value of 2 variable values int i = 10; define the integer variable i as 10 int j = 5; define the integer variable j as 5 int k = 0; define the integer variable k = 0 k = MAX (i, j) ; Apply the MAX () function and max value store in k printf ( “% d % d % d” , i, j, k) ; printf prints the value of i = 10, j = 5 and k = 10

## Question 221

C & C Plus Plus
Edit

### Write in Short

What do u meant by “SBI” of an object?

### Explanation

• SBI stands for State, Behavior, and Identity. Every object has the above three.
• State: Values of attributes of an object at a particular time.
• Behaviour: Describes actions and their reactions of the object.
• Identity: Characterization, which makes it possible to distinguish an object in an unambiguous way, and independently from its state.

## Question 222

C & C Plus Plus
Edit

### Describe in Detail

Essay▾

What is the use of typedef?

### Explanation

• Typedef is keyword used to assign alternative names to existing datatypes.
• Mostly used with user defined datatype, when names of the datatypes become slightly complicated to use in programs.

Syntax for using typedef:

Typedef < existing_name >< alias_name >

Application of typedef:

• Typedef can used to a name to user defined data type as well.
• For example structure:

typedef struct

{

type member1;

type member2;

type member3;

} type_name;

Developed by: