Solutions for Class 12 Computer Application: Chapter 02 Arrays
Review structured textbook solutions for Class 12 Computer Application Chapter 02 Arrays. Built according to Kerala Board guidelines for the 2026-27 academic year, these downloadable answers support daily revision and problem-solving accuracy.
Practice Class 12 Computer Application Solutions: Chapter 02 Arrays
Access the complete solution PDF for Class 12 Computer Application below. Regular practice with these targeted textbook answers builds familiarity with standard question patterns and helps secure higher marks in final school evaluations.
One Mark Questions and Answers
Question 1: Write the C++ initialization statement to initialize an integer array named 'MARK' with the values 70, 80, 85, 90. (March 2017)
Answer:
int MARK[4] = {70, 80, 85, 90};
The size can also be left out, because the compiler counts the values: int MARK[] = {70, 80, 85, 90};
Another way is to assign each element separately:
int MARK[4];
MARK[0] = 70;
MARK[1] = 80;
MARK[2] = 85;
MARK[3] = 90;
Exam Tips:
a) Start the statement with the data type (int), then the array name, then the size in square brackets and the values in braces.
b) Index numbers begin at 0, so four values occupy MARK[0] to MARK[3].
Two Mark Questions and Answers
Question 2: How is memory allocated for a float array? (March 2016)
Answer:
Each element of a float array occupies 4 bytes of memory.
Total bytes = size of the array * 4
Example: float n[10];
Here total bytes = 10 * 4 = 40 bytes.
Exam Tips:
a) Write the formula first, then work out the example with the numbers.
b) Remember that the memory used depends on the data type: int and float use 4 bytes each, while char uses 1 byte.
Question 3: How can we initialize an integer array? Give an example. (March 2016)
Answer:
The elements of an array can be initialized at the time of declaration. The values are written inside braces, separated by commas.
Example: int n[5] = {10, 20, 30, 40, 50};
Exam Tips:
a) Include the data type, size and the braces in your example.
b) The number of values must not be more than the size of the array.
Question 4: Answer any one of the following. (March 2016)
a) Define an array. Give an example of an integer array declaration.
b) Consider the following C++ code: char text[20]; cin >> text;
If the input string is "Computer Programming", what will be the output? Justify your answer.
Answer:
a) An array is a collection of elements of the same data type stored in consecutive memory locations.
Example: int n[100]; This is an array named n which can store 100 elements. The index of the first element is 0 and the index of the last element is 99.
b) The output is "Computer".
The reason is that cin reads characters only up to a space. The space acts as a delimiter, so the characters after the space ("Programming") are not stored in the array.
Exam Tips:
a) In part (a), state that all the elements have the same data type and give the first and last index of your example.
b) In part (b), name the reason (space is a delimiter for cin) and mention that gets() can be used to read a whole line with spaces.
Three Mark Questions and Answers
Question 5: Write a C++ program to input 10 numbers into an integer array and find the sum of the numbers which are exact multiples of 5. (March 2017)
Answer:
#include <iostream>
using namespace std;
int main()
{
int n[10], i, sum = 0;
for (i = 0; i < 10; i++)
{
cout << "Enter value for number " << i + 1 << ": ";
cin >> n[i];
if (n[i] % 5 == 0)
sum += n[i];
}
cout << "The sum of numbers which are exact multiples of 5 is " << sum;
return 0;
}
Exam Tips:
a) A number is an exact multiple of 5 when the remainder of its division by 5 is 0, that is n[i] % 5 == 0.
b) Set sum = 0 before the loop, otherwise it starts with a garbage value.
c) Check that every cout and cin statement ends with a semicolon.
Five Mark Questions and Answers
Question 6: Write a C++ program to accept a string and count the number of words and vowels in that string. (March 2016)
Answer:
#include <iostream>
#include <cstdio>
#include <cctype>
using namespace std;
int main()
{
int i, vowel = 0, words = 1;
char str[80];
cout << "Enter a string\n";
gets(str);
for (i = 0; str[i] != '\0'; i++)
{
if (str[i] == 32)
words++;
switch (tolower(str[i]))
{
case 'a': case 'e': case 'i': case 'o': case 'u':
vowel++;
}
}
cout << "The number of words is " << words;
cout << "\nThe number of vowels is " << vowel;
return 0;
}
Exam Tips:
a) Start words from 1 and add 1 for every space (ASCII 32), because a sentence has one more word than the number of spaces.
b) Use tolower() (from cctype) so that both capital and small vowels are counted.
c) In a for statement, the three parts are separated by semicolons, not commas.
d) A switch with several case labels one after another lets all the vowels share one statement.
Question 7: Write a C++ program to accept N integer numbers and find the sum and average of the even numbers. (March 2016)
Answer:
#include <iostream>
using namespace std;
int main()
{
float avg = 0, sum = 0;
int N, i, no, count = 0;
cout << "Enter how many numbers: ";
cin >> N;
for (i = 0; i < N; i++)
{
cout << "Enter number " << i + 1 << ": ";
cin >> no;
if (no % 2 == 0)
{
sum += no;
count++;
}
}
if (count > 0)
avg = sum / count;
cout << "The sum of even numbers is " << sum;
cout << "\nThe average of even numbers is " << avg;
return 0;
}
Exam Tips:
a) The average of the even numbers is the sum divided by how many even numbers there are, not by N.
b) Declare sum as float (or use type casting) so that the average is not cut to a whole number.
c) Put all the statements of the loop body inside braces.
Question 8: Answer any one of the following. (May 2016)
a) Write a C++ program to accept a string and find the length of the string without using a built-in function. Use a character array to store the string.
b) Write a program to input N numbers into an integer array and find the largest number in the array.
Answer:
a)
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char str[80];
int i;
cout << "Enter a string: ";
gets(str);
for (i = 0; str[i] != '\0'; i++);
cout << "The length of the string is " << i;
return 0;
}
b)
#include <iostream>
using namespace std;
int main()
{
int N, no[50], i, largest;
cout << "Enter how many numbers: ";
cin >> N;
for (i = 0; i < N; i++)
{
cout << "Enter number " << i + 1 << ": ";
cin >> no[i];
}
largest = no[0];
for (i = 1; i < N; i++)
if (no[i] > largest)
largest = no[i];
cout << "The largest number is " << largest;
return 0;
}
Exam Tips:
a) The length of a string is the index at which the null character '\0' is found, so loop until str[i] is '\0'.
b) Start the loop counter with the digit 0, not the letter o.
c) For the largest number, assume the first element is the largest and compare every other element with it.
Question 9: Write a C++ program to enter 10 numbers into an array and find the second largest element. (May 2016)
Answer:
#include <iostream>
using namespace std;
int main()
{
int i, j, n[10], temp;
for (i = 0; i < 10; i++)
{
cout << "Enter a value for number " << i + 1 << ": ";
cin >> n[i];
}
for (i = 0; i < 9; i++)
{
for (j = i + 1; j < 10; j++)
if (n[i] < n[j])
{
temp = n[i];
n[i] = n[j];
n[j] = temp;
}
}
cout << "The second largest number is " << n[1];
return 0;
}
Exam Tips:
a) The program sorts the array in descending order, so the largest number goes to n[0] and the second largest to n[1].
b) The swap needs three statements using a temporary variable.
c) Note that if the largest value occurs twice, n[1] will repeat it; mention this if the question asks for a distinct second largest.
Question 10: Write a C++ program to convert all lowercase alphabets stored in a string to uppercase. (May 2016)
Answer:
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char line[80];
int i;
puts("Enter the string to convert");
gets(line);
for (i = 0; line[i] != '\0'; i++)
if (line[i] >= 97 && line[i] <= 122)
line[i] = line[i] - 32;
puts(line);
return 0;
}
Exam Tips:
a) The ASCII values of small letters a to z are 97 to 122, and subtracting 32 gives the matching capital letter.
b) Check the range with the AND operator (&&) so that digits, spaces and capital letters are left unchanged.
c) Write the null character as '\0' with straight quotes.
Free study material for Computer Application
Computer Application Class 12 Curriculum Solutions: Chapter 02 Arrays
Official Kerala Board Solutions for Chapter 02 Arrays
Explore reliable textbook solutions for Chapter 02 Arrays tailored for Class 12 learners. Utilizing these complete exercise answers ensures your preparation aligns exactly with official Kerala Board standards for Computer Application.
Step-by-Step Explanations for Chapter 02 Arrays
Beyond providing final answers, these guides offer step-by-step breakdowns for complex queries in the Class 12 Computer Application module. This approach helps students balance theoretical depth with practical problem-solving skills required for Kerala Board exams.
Next Steps in Your Computer Application Revision
These resources act as an effective roadmap for daily homework tasks and independent study. Supplement your review of Chapter 02 Arrays with official sample papers and interactive practice tests available on our platform free of charge.
FAQs
The complete and updated Kerala Plus Two Computer Application Previous Questions Chapter 2 Arrays is available for free on StudiesToday.com. These solutions for Class 12 Computer Application are as per latest Kerala Board curriculum.
Yes, our experts have revised the Kerala Plus Two Computer Application Previous Questions Chapter 2 Arrays as per 2026 exam pattern. All textbook exercises have been solved and have added explanation about how the Computer Application concepts are applied in case-study and assertion-reasoning questions.
Toppers recommend using Kerala Board language because Kerala Board marking schemes are strictly based on textbook definitions. Our Kerala Plus Two Computer Application Previous Questions Chapter 2 Arrays will help students to get full marks in the theory paper.
Yes, we provide bilingual support for Class 12 Computer Application. You can access Kerala Plus Two Computer Application Previous Questions Chapter 2 Arrays in both English and Hindi medium.
Yes, you can download the entire Kerala Plus Two Computer Application Previous Questions Chapter 2 Arrays in printable PDF format for offline study on any device.