MCQ Answer

<p>What will be the output of the following code C?</p><pre><span style="font-size: 12.6px;">#include &lt;stdio.h&gt; void solve(){ char ch[5] = "abcde"; int ans=0; for(int i =0; i&lt; 5; i++) { ans += (ch[i] - 'a'); } printf("%d", ans); } int main(){ solve(); return 0; }</span><br></pre>

What will be the output of the following code C?

#include <stdio.h>
 void solve(){
char ch[5] = "abcde";
int ans=0;
for(int i =0; i< 5; i++) {
ans += (ch[i] - 'a');
}
printf("%d", ans);
}
int main(){
solve();
return 0;
}


निम्नलिखित कोड का आउटपुट क्या होगा?

#include <stdio.h>
 void solve(){
char ch[5] = "abcde";
int ans=0;
for(int i =0; i< 5; i++) {
ans += (ch[i] - 'a');
}
printf("%d", ans);
}
int main(){
solve();
return 0;
}
Topic : Building IoT Applications

A. 5

B. 20

C. 40

D. 10




Correct Answer is :

D. 10



Explanation


Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad