Download Kerala Board Solutions for Class 12 Computer Application Chapter 03 Functions
Explore reliable textbook solutions for Chapter 03 Functions tailored for Class 12 learners. Utilizing these Computer Application answers ensures thorough preparation and strengthens foundational knowledge before final Kerala Board evaluations.
Access Kerala Board Solutions and Answers
Navigate directly to the solved Computer Application textbook exercises using the digital viewer below. Each solution includes detailed step-by-step explanations, allowing students to instantly cross-check their work and identify areas requiring further revision.
1 Mark Questions and Answers
Question 1: The ______ function is used to check whether a character is alphanumeric. (MAY-2016)
a) isdigit( )
b) isalnum( )
c) isupper( )
d) islower( )
Answer:
b) isalnum( )
It returns a non-zero value if the character is a letter or a digit.
Exam Tips:
a) The functions isalpha( ), isdigit( ) and isalnum( ) are declared in the header file cctype; remember what each one tests.
b) isalnum( ) is true for both letters and digits, so it covers the cases of isalpha( ) and isdigit( ) together.
Question 2: What will be the output of the following code? (MAY-2017)
char s1[10] = "hello", s2[10];
strcpy(s2, s1);
cout << s2;
Answer:
hello
strcpy( ) copies the string in s1 into s2, so s2 also holds "hello".
Exam Tips:
a) In strcpy(destination, source) the first argument receives the copy of the second one.
b) Write just the printed output, without quotation marks, unless the question asks otherwise.
2 Marks Questions and Answers
Question 3: Consider the following code: (MARCH-2016)
char S1[ ] = "program";
char S2[ ] = "PROGRAM";
int n;
n = strcmpi(S1, S2);
What is the value of n?
a) n = 0
b) n = 1
c) n > 1
d) n < 0
Answer:
a) n = 0
strcmpi( ) ignores the difference between upper case and lower case letters, so the two strings are treated as equal and the function returns 0.
Exam Tips:
a) strcmp( ) is case sensitive but strcmpi( ) is not. Mention this reason along with the answer.
b) Remember the return values: 0 for equal strings, a positive value if the first string is greater, a negative value if it is smaller.
Question 4: Explain two stream functions for input operation with an example. (MARCH-2017)
Answer:
Input stream functions are used with cin and the dot (.) operator.
1) get( ) reads a single character from the keyboard. Eg: cin.get(ch);
2) getline( ) reads a line of characters from the keyboard. Eg: cin.getline(str, len);
Exam Tips:
a) Write the example call for each function, since the question asks for an example.
b) Remember the syntax: the object cin, then the dot operator, then the function name.
Question 5: Explain how a string is allocated in memory. (MAY-2017)
Answer:
A null character ('\0') is automatically added at the end of every string, and it is counted as one character.
For example, in the declaration char name[20]; one extra location is needed for the null character, so a name of up to 19 characters can be stored.
Exam Tips:
a) Always mention the null character '\0' as the string terminator.
b) A string of n characters needs an array of size n + 1.
Question 6: Explain the gets( ) and puts( ) functions. (MAY-2017)
Answer:
gets( ) is used to read a string from the keyboard, including the spaces in it.
puts( ) is used to display a string on the screen.
To use these functions the header file cstdio must be included in the program.
Exam Tips:
a) Point out that gets( ) accepts spaces, whereas cin >> stops reading at a space.
b) Do not forget to name the header file cstdio.
3 Marks Questions and Answers
Question 7: Explain any three stream functions for I/O operations. (MARCH-2016)
Answer:
The stream functions for I/O operations are:
1) get( ): reads a character from the keyboard. Eg: cin.get(ch);
2) getline( ): reads a line of characters from the keyboard. Eg: cin.getline(str, len);
3) put( ): displays a character on the screen. Eg: cout.put('A');
4) write( ): displays a line of characters on the screen. Eg: cout.write(str, len);
Exam Tips:
a) Input functions (get, getline) go with cin and output functions (put, write) go with cout.
b) Give one example for each of the three functions you choose.
Question 8: Write code to do the following: (MARCH-2016)
a) A function named largest accepts two integer numbers and returns the larger number.
b) Use this function to find the larger of two numbers.
Answer:
a)
int largest(int a, int b)
{
if (a > b)
return a;
else
return b;
}
b)
void main( )
{
int x, y;
cout << "Enter 2 numbers";
cin >> x >> y;
cout << "The largest among these is " << largest(x, y);
}
Exam Tips:
a) Write the return type, function name and parameter list correctly in the first line of the function.
b) In part (b) pass the values read from the user as arguments and print the value returned by the function.
c) Include the header file iostream and write using namespace std; when you write a complete program.
Question 9: Explain any three string functions with examples. (MAY-2016)
Answer:
Functions that are already available in C++ are called pre-defined or built-in functions. We can also create our own functions for a specific task; these are called user-defined functions. Every C++ program must contain a main( ) function, and execution of the program starts and ends in main( ).
Some functions need data to do their task; this data is called a parameter or argument. Some functions return a value to the calling function.
String functions: to use them, the header file string.h (cstring) must be included.
a) strlen( ): finds the number of characters in a string (its length).
Syntax: strlen(string);
Eg: cout << strlen("Computer"); prints 8.
b) strcpy( ): copies the second string into the first string.
Syntax: strcpy(string1, string2);
Eg: strcpy(str, "BVM HSS"); cout << str; prints BVM HSS.
c) strcat( ): joins (concatenates) the second string to the end of the first string.
Syntax: strcat(string1, string2);
Eg: strcpy(str1, "Hello"); strcpy(str2, " World"); strcat(str1, str2); cout << str1; displays the string "Hello World".
d) strcmp( ): compares two strings and returns an integer.
Syntax: strcmp(string1, string2);
If the value is 0, both strings are equal. If it is positive, string1 is greater than string2. If it is negative, string2 is greater than string1.
Eg:
#include <iostream>
#include <cstring>
using namespace std;
int main( )
{
char str1[10], str2[10];
strcpy(str1, "Kiran");
strcpy(str2, "Jobi");
cout << strcmp(str1, str2);
}
It returns a positive integer.
e) strcmpi( ): works like strcmp( ) but is not case sensitive, so upper case and lower case letters are treated as the same. Eg: "ANDREA", "Andrea" and "andrea" are the same.
#include <iostream>
#include <cstring>
using namespace std;
int main( )
{
char str1[10], str2[10];
strcpy(str1, "Kiran");
strcpy(str2, "KIRAN");
cout << strcmpi(str1, str2);
}
It returns 0, which means both strings are the same.
Exam Tips:
a) Choose any three functions and write the syntax and a short example for each; this is what carries the marks.
b) Mention the header file (string.h or cstring) needed for string functions.
c) Remember the return value of strcmp( ): 0, positive or negative.
Question 10: Write a function that accepts 3 numbers of type float as arguments and returns their average. Write a program that uses this function to find the average of three numbers in C++. (MAY-2016)
Answer:
#include <iostream>
using namespace std;
float avg(float n1, float n2, float n3)
{
return ((n1 + n2 + n3) / 3);
}
int main( )
{
float x, y, z;
cout << "Enter 3 numbers";
cin >> x >> y >> z;
cout << "The average is " << avg(x, y, z);
}
Exam Tips:
a) The function must have return type float, because the average may have a fractional part.
b) Divide the sum by 3 and keep the sum in brackets, otherwise only n3 gets divided.
c) Show the function call avg(x, y, z) in main( ).
Question 11: "Initialized formal arguments are called default arguments." Using this concept, write the function prototype and definition of a user-defined function sum( ) which accepts two or three integer numbers and returns their sum. (MARCH-2017)
Answer:
Prototype:
int sum(int x, int y, int z = 0);
Definition and use:
#include <iostream>
using namespace std;
int sum(int x, int y, int z = 0)
{
return (x + y + z);
}
int main( )
{
cout << sum(1, 2) << endl;
cout << sum(1, 2, 3) << endl;
}
Output:
3
6
Here z has the default value 0, so when only two numbers are passed the third one adds nothing to the sum.
Exam Tips:
a) Default values are given from the right side, so only the last argument z gets a default here.
b) Write the prototype separately and end it with a semicolon.
c) Show calls with two and with three arguments to prove both cases work.
Question 12: Write the output of the following code segment. (MARCH-2017)
char S1[25] = " Computer";
char S2[15] = " Applications";
strcat(S1, S2);
cout << S1;
Answer:
The output is " Computer Applications".
The second string is joined to the end of the first string, and the leading spaces in the strings are kept.
Exam Tips:
a) strcat( ) changes only the first string, so S1 holds the joined result.
b) Copy the characters carefully, including any spaces inside the quotation marks.
Question 13: Explain three string functions in C++. (MAY-2017)
Answer:
a) strlen( ): finds the number of characters in a string (its length).
Syntax: strlen(string);
Eg: cout << strlen("Computer"); prints 8.
b) strcpy( ): copies the second string into the first string.
Syntax: strcpy(string1, string2);
Eg: strcpy(str, "BVM HSS"); cout << str; prints BVM HSS.
c) strcat( ): joins the second string to the end of the first string.
Syntax: strcat(string1, string2);
Eg: strcpy(str1, "Hello"); strcpy(str2, " World"); strcat(str1, str2); cout << str1;
It displays the joined string "Hello World".
Exam Tips:
a) Write the name, syntax and an example for each function.
b) Remember that strcpy( ) and strcat( ) change the first string, not the second.
c) Include the header file string.h (cstring) in programs that use these functions.
Question 14: Write a program using a function to interchange the values of two variables. (Use the call by reference method for passing arguments.) (MAY-2017)
Answer:
#include <iostream>
using namespace std;
void swap(int &x, int &y)
{
int temp;
temp = x;
x = y;
y = temp;
}
int main( )
{
int x = 100, y = 200;
cout << "Values before swap" << endl;
cout << "x=" << x << ", y=" << y << "\n";
swap(x, y);
cout << "Values after swap" << endl;
cout << "x=" << x << ", y=" << y << "\n";
return 0;
}
Output:
Values before swap
x=100, y=200
Values after swap
x=200, y=100
Exam Tips:
a) In call by reference the parameters are written with & (int &x, int &y), so changes made inside the function affect the original variables.
b) Use a temporary variable to hold one value while swapping.
c) Print the values before and after calling the function to show that the swap worked.
Free study material for Computer Application
Free Kerala Board Textbook Explanations: Class 12 Computer Application Chapter 03 Functions
Textbook Solutions for Class 12 Computer Application Chapter 03 Functions
Explore reliable textbook solutions for Chapter 03 Functions tailored for Class 12 learners. Utilizing these complete exercise answers ensures your preparation aligns exactly with official Kerala Board standards for Computer Application.
Mastering Theoretical and Practical Questions
Each solution includes detailed reasoning to foster genuine comprehension of Chapter 03 Functions concepts. Reviewing these step-by-step breakdowns allows learners to master both analytical and descriptive questions expected in school evaluations.
Effective Self-Study and Homework Assistance
These resources act as an effective roadmap for daily homework tasks and independent study. Supplement your review of Chapter 03 Functions 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 3 Functions 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 3 Functions 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 3 Functions 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 3 Functions in both English and Hindi medium.
Yes, you can download the entire Kerala Plus Two Computer Application Previous Questions Chapter 3 Functions in printable PDF format for offline study on any device.