c Questions for 24 Aug
c Questions for 24 Aug
c Questions for 24 Aug
#include <stdio.h>
void solve() {
int a[] = {1, 2, 3, 4, 5};
int sum = 0;
for(int i = 0; i < 5; i++) {
if(i % 2 == 0) {
sum += *(a + i);
}
else {
sum -= *(a + i);
}
}
printf("%d", sum);
}
int main() {
solve();
return 0;
}
a-2
b.15
c.syntax error
d.3
Ans d
#include <stdio.h>
void solve() {
int x = 2;
printf("%d", (x << 1) + (x >> 1));
}
int main() {
solve();
return 0;
}
a-2
b.15
c.syntax error
d.3
Ans a
a) 2
b) 6
c) 4
d) 1
Answer: (d)
8. What type of data type does the atoi() function return?
a) String
b) char
c) Integer
d) Float
Answer: (c)
Answer: (a)
main ()
{
if(5 < '5')
printf("5")
else
printf("Not equal to 5.")
}
a) ENQ
b) 5
c) I
d) Not equal to 5
Answer: (b)