# 3i Infotech Placement: Sample Questions 1233 - 1234 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 1233

Edit

### Describe in Detail

Essay▾

What is the output of the following program?

1. `#include<stdio.h>`
2. `void main ()`
3. `{`
4. `    int a ={ { 10, 2}, { 5, 6} };`
5. `    int ⚹p, ⚹q;`
6. `    p =&a;`
7. `    q =⚹ ⚹⚹ a;`
8. `    printf ( “%d…%d” ⚹p, ⚹q);`
9. `}`

### Explanation

In the program

 int a    = { {10,2} , {5,6} } ; Given the integer 2D array and values int ⚹ p, ⚹ q; Given the integer pointer and q p = &a    ; p = &a    declares only two dimensions 2D arrays.But trying to access the third dimension (which was not declared) will print garbage values. ⚹ q =⚹ ⚹⚹ a; q =⚹ ⚹⚹ a starting address of a is assigned integer pointer.Now q is pointing to starting address of a.If you print ⚹ q it will print first element of 3D array

## Question 1234

Edit

### Describe in Detail

Essay▾

What is the output of the following program?

1. `void main ()`
2. `{`
3. `    char ch;`
4. `    for(ch=0; ch<=127;ch++)`
5. `    printf (“%c %d ”, ch, ch);`
6. `}`

### Explanation

Implementation dependent

In the program

 char ch; Define the character variable ch. for (ch = 0; ch <= 127; ch ++) The char type may be signed or unsigned by default.If it is signed- when ch ++ is executed ch reaches 127 and rotates back to -128Thus ch is always smaller than 127. printf ( “% c % d” , ch, ch) ; Printf prints the value of ch

Developed by: