Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 4 : 10 / 10

Advertisement

Detailed Solution

सही उत्तर 10 / 10 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

What is the output of the following C program on a typical platform where int occupies 4 bytes? / उस विशिष्ट प्लेटफ़ॉर्म पर निम्नलिखित C प्रोग्राम का आउटपुट क्या होगा जहाँ int 4 बाइट का होता है?

#include <stdio.h> int main() { int arr[10]; printf("%d", (int)sizeof(arr) / (int)sizeof(arr[0])); return 0; }

1.
4 / 4
2.
40 / 40
3.
1 / 1
4.
10 / 10

Correct Answer: 10 / 10

sizeof(arr) is 40 bytes and sizeof(arr[0]) is 4 bytes, so the division yields 10, the number of elements. / sizeof(arr) 40 बाइट और sizeof(arr[0]) 4 बाइट है, अतः भागफल 10 — अवयवों की संख्या — मिलता है।

Downloaded from PrepSnap (prepsnap.in)