What will be the result of the following code snippet?
#include <stdio.h>
void solve()
{
char ch[10] = "abcdefghij";
int ans = 0;
for(int i = 0; i < 10; i++)
{
ans += (ch[i] - 'a');
}
printf("%d", ans);
}
int main()
{
solve();
return 0;
}
TPEC4
Quiz
•
Computers
•
Professional Development
•
Medium
Revathy BD
Used 4+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will be the result of the following code snippet?
#include <stdio.h>
void solve()
{
char ch[10] = "abcdefghij";
int ans = 0;
for(int i = 0; i < 10; i++)
{
ans += (ch[i] - 'a');
}
printf("%d", ans);
}
int main()
{
solve();
return 0;
}
45
35
20
100
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
#include "stdio.h"
int main()
{
int x, y = 5, z = 5;
x = y == z;
printf("%d", x);
getchar();
return 0;
}
0
1
5
Compiler Error
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How is an array initialized in C language?
int a = {1, 2, 3};
int a(3) = [1, 2, 3];
int a[] = new int[3];
int a[3] = {1, 2, 3};
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How is the 3rd element in an array accessed based on pointer notation?
*(a + 3)
*a + 3
&(a + 3)
(a + 3)
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How to find the length of an array in C?
sizeof(a[0])
sizeof(a) / sizeof(a[0])
sizeof(a) * sizeof(a[0])
sizeof(a)
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the output of the following code snippet?
#include <stdio.h>
#include<stdlib.h>
void set(int to)
{
to = (int)malloc(5 sizeof(int));
}
void solve()
{
int ptr; set(ptr); ptr = 10;
printf("%d", ptr);
}
int main()
{
solve();
return 0;
}
10
The program may crash.
Cannot Say
Garbage Value
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
From following which is not the operation of data structure?
Operations that manipulate data in some way
Operations that perform a computation
Operations that check for syntax errors
Operations that check for syntax errors
15 questions
Code X Trade
Quiz
•
Professional Development
20 questions
first round quiz
Quiz
•
Professional Development
10 questions
Java Increment & Decrement Operators
Quiz
•
Professional Development
10 questions
Unity & C-Sharp Quiz
Quiz
•
Professional Development
13 questions
MindSpace Computers C Quiz-1 2025
Quiz
•
Professional Development
15 questions
C PROGRAMMING BASICS-QUIZ-1
Quiz
•
Professional Development
10 questions
php- basics
Quiz
•
Professional Development
17 questions
Java Basics
Quiz
•
Professional Development
15 questions
Multiplication Facts
Quiz
•
4th Grade
20 questions
Math Review - Grade 6
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
5 questions
capitalization in sentences
Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions
Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines
Quiz
•
Professional Development
12 questions
Dividing Fractions
Quiz
•
6th Grade