# 3i Infotech Placement: Sample Questions 825 - 826 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

## Question 825

### Question

MCQ▾

Tom received 89,94, 86, and 96 on the first algebra tests. What grade must he receive on his last test to have an average of 92?

Choice (4)

a.

91

b.

92

c.

95

d.

94

c.

### Explanation

Tom received 89,94, 86 and 96 on the four algebra tests.

After five tests average of all test scores is 92.

We are asked to find the grade in the fifth algebra test. Let it be x.

So, Tom has scored 95 in the last fifth test.

## Question 826

Edit

### Describe in Detail

Essay▾

What is the output of the following program?

1. `main ()`
2. `{`
3. `    int i, n;`
4. `    char ⚹x =“girl”;`
5. `    n =strlen(x);`
6. `    ⚹x =x[n];`
7. `    For( i =0; i<n;++i)`
8. `    {`
9. `        printf (%s, x);`
10. `        x ++;`
11. `    }`
12. `}`

### Explanation

(Blank space)

irl

rl

l

In a program

 int i, n; Define integer variable I and n. char ⚹ x = “girl” ; String (a pointer to char) is initialized with a value “girl” . n = strlen (x) ; The strlen function returns the length of thestring, thus n has a value 4. ⚹ x = x [n] ; This statement assigns value at the nth location ( ‘⧵0’ ) to the first location. Nowthe string becomes “⧵0irl” . For (i = 0; i < n; ++ i){printf (% s, x) ;x ++ ;} Printf statement printsthe string. After each iteration it increments it starting position. Loop starts from 0 to 4.The first time x  = ‘⧵0’ hence it prints nothing and pointer value is incremented.The second time it prints from x  i.e.. “irl”The third time it prints “rl”And the last time it prints “l” and the loop terminates.

Developed by: