# ST Microelectronics Placement: Sample Questions 7 - 9 of 40

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

## Question 7

Edit

### Write in Short

Two lemons cost 10 cents. Then one and a half dozen cost

### Explanation

1 dozen = 12 pieces

So one and half dozen = 12 + 6 = 18 pieces, i.e. There are 18 pieces of lemon.

Cost of 2 lemons = 10 cents

Cost of 18 lemons = (?)

=

=

= 90

So, Cost of one and half dozen will be 90 cents.

## Question 8

Edit

### Write in Short

The girl՚s age is twice that of boy, if the boy is four years old. After four years what will be the age of girl?

### Explanation

At present,

Boy՚s age, b = 4 years

Girl՚s age, g = 2b = 8 years

After 4 years

Boy՚s age, = b + 4 = 8 years

Girl՚s age, = g + 4 = 12 years

After 4 years age of girl will be 12 years.

## Question 9

Edit

### Write in Short

What will be the output of the given C program?

1. `main()`
2. `{`
3. `    chari;`
4. `    for (i =0, i<=255, i++)`
5. `    {`
6. `        printf(“%c”, i);`
7. `    }`
8. `}`

### Explanation

• Here, variable i is defined as character variable. A character variable is by default a signed character. It has range from -128 to + 127. If we want to define any character be unsigned then we need to add unsigned keyword before declaring it. Unsigned character has range from 0 to 255.
• Here, as i is a signed character it cannot take value bigger than + 127. Hence when value of i is + 127 and we perform i ++ it becomes -128 instead of + 128. -128 is less than 255, hence the condition is still satisfied. Here onward i would take values like -127, -126, -125, … , + 126, + 127, -128, -127, … etc.
• Thus this is an indefinite loop.

Developed by: