0% found this document useful (0 votes)
12 views2 pages

2023 Computer Application Honours Theory Exam Questions Along With Answers, Based On Available Sources

The document contains sample questions and answers for the 2023 Computer Application Honours theory exam. It includes topics such as class design, logical operators, function prototypes, infinite loops, polymorphism, and array initialization with linear search. Each question is accompanied by a concise answer relevant to programming concepts.

Uploaded by

banishalyngwa99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

2023 Computer Application Honours Theory Exam Questions Along With Answers, Based On Available Sources

The document contains sample questions and answers for the 2023 Computer Application Honours theory exam. It includes topics such as class design, logical operators, function prototypes, infinite loops, polymorphism, and array initialization with linear search. Each question is accompanied by a concise answer relevant to programming concepts.

Uploaded by

banishalyngwa99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

2023 Computer Application Honours theory exam questions along

with answers, based on available sources:

Sample Questions and Answers for 2023 Computer Application


Honours

Question 1

Design a class named Student with member variables: name, age, marks, stream. Include
methods to accept data, allocate stream based on marks, and print the details.

Answer:
A Student class in C++/Java with methods to accept input, allocate stream according to
marks criteria, and display the details.

Question 2

What is the type of operator &&? Explain its usage.

Answer:
&& is a logical operator that evaluates to true if both operands are true; otherwise, false.

Used for compound logical conditions.

Question 3

Write a method prototype for a function named check that takes an integer argument and
returns a character.

Answer:
char check(int x);

Question 4
What is an infinite loop? Give an example.

Answer:
A loop that runs forever without termination. Example:

for (int i = 5; i != 0; i += 2) {
// Loop conditions never met to exit
}

Question 5

Explain polymorphism in object-oriented programming.

Answer:
Polymorphism allows classes to be treated as instances of their parent class, enabling
methods to perform differently based on the object calling it (method overloading and
overriding).

Question 6

Explain how to declare and initialize a one-dimensional array in C. Write a program to


perform linear search on it.

Answer:

int arr[^5] = {1, 2, 3, 4, 5};


// Linear search
int key = 3, found = 0;
for (int i = 0; i < 5; i++) {
if (arr[i] == key) {
printf("Found at position %d\n", i);
found = 1;
break;
}
}
if (!found) printf("Not found\n");

You might also like