0% found this document useful (0 votes)
12 views

Hsslive-xi-cs-KEY-dec-2024-menoup

2024 mid term exam computer science answer key

Uploaded by

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

Hsslive-xi-cs-KEY-dec-2024-menoup

2024 mid term exam computer science answer key

Uploaded by

fepim16795
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

FIRST YEAR HIGHER SECONDARY SECOND TERMINAL EXAMINATION DECEMBER 2024

ANSWER KEY
SUBJECT: COMPUTER SCIENCE

1-Mark Questions (Answer any 5)

1. X + X = X and X . X = X denotes which Law?


Answer: Idempotent Law
2. The program written in High-Level Language is called:
Answer: Source code
3. Which of the following is the conditional operator?
Answer: ?:
4. Supplying value to a variable at the time of its declaration is called:
Answer: Initialisation
5. An if statement written inside another if statement is called:
Answer: Nested if statement
6. Which of the following is the header file used to include gets() function in C++?
Answer: <cstdio>

2-Mark Questions (Answer any 9)


7. Write short notes on the following:
(a) Abacus:
Answer: The abacus is the earliest known calculating device, used for basic arithmetic operations.
(b) Pascaline:
Answer: The Pascaline is a mechanical calculator invented by Blaise Pascal, capable of addition and
subtraction.
8. Write notes on the following:
(a) ASCII:
Answer: ASCII (American Standard Code for Information Interchange) is a 7-bit character encoding
standard.
(b) Unicode:
Answer: Unicode is a universal character encoding standard that supports characters from all languages.
9. Represent -34 in 1's complement form:
Answer: Convert 34 to binary: 00100010.
o Take the 1's complement (invert the bits): 11011101.
10. Briefly explain any two input devices:
Answer:
 Keyboard: Used to input text, numbers, and commands into a computer.
 Mouse: A pointing device used to interact with a graphical user interface (GUI).
11. Compare RAM and ROM:
Answer:
 RAM: Volatile memory used for temporary data storage.
 ROM: Non-volatile memory used to store permanent instructions.
12. Identify different types of tokens from those given below:
Tokens: for (keyword), 72.34 (literal), % (operator), \n (literal).
13. Briefly explain any two types of literals in C++:
Answer:
 Integer literal: Represents whole numbers (e.g., 10).
 String literal: Represents text enclosed in double quotes (e.g., "Hello").

PREPARED BY MENOUP T, THARAKAN HSS ANGADIPURAM, MALAPPURAM


14. Define the following terms:
(a) Variable: A named memory location used to store data.
(b) Data type: Specifies the type of data a variable can hold (e.g., int, float).
15. Rewrite the following loop using while:
Question: for(i=0;i<100;i++) { cout << i; }
Answer:
int i = 0;
while (i<100)
{
cout<<i;
i++;
}
16. Explain briefly any two jump statements in C++:
Answer:
 Break: Terminates the loop or switch statement.
 Continue: Skips the current iteration of the loop and proceeds to the next iteration.
17. Define the term Array. Give an example of an array declaration:
Answer:
Array: A collection of elements of the same data type stored in contiguous memory locations.
Example: int arr[5];
18. Define the following terms:
(a) Array Initialization: Assigning values to an array at the time of declaration.
Example: int arr[3]={1,2,3};
(b) Array Traversal: Accessing each element of the array sequentially.

3-Mark Questions (Answer any 9)

19. Briefly explain the following:


(a) First Generation Computers: Used vacuum tubes, were large in size, and consumed a lot of power.
(b) Difference Engine: A mechanical calculator invented by Charles Babbage to compute polynomial
functions.
(c) Turing Machine: A theoretical device proposed by Alan Turing, forming the basis of modern
computation.
20. Briefly explain any three number systems:
Answer:
 Binary: Base-2 system (0, 1).
 Decimal: Base-10 system (0 to 9).
 Hexadecimal: Base-16 system (0-9 and A-F).
21. Draw the diagram and truth table of the following gates:
(a) OR Gate
Diagram: Truth Table:

PREPARED BY MENOUP T, THARAKAN HSS ANGADIPURAM, MALAPPURAM


(b) AND Gate
Diagram: Truth Table:

22. Briefly explain any three methods of disposing of e-waste:


Answer:
a. Reuse: Second-hand use.
b. Incineration: Controlled, combustion process in which waste is burned at a high temperature.
c. Recycling: Making new products from old devices.
23. Briefly explain any three advantages of Flowcharts:
Answer:
(a)Better communication
(b)Effective analysis ( The whole program can be analysed effectively )
(c)Effective synthesis ( bigger programs can be subdivided and its solution can represented in flowcharts
separately and can finally placed together)
(d)Efficient Coding ( The flow chart act as a road map through which the programmer can develop
program with out omission of important steps) .
24. Briefly explain three types of errors that occur during programming:
Answer:
(a). Syntax error. It is happened by violating the rules of writing programs statements, improper
sequencing of instructions or incorrect use of punctuations. All language processors detect these errors. In
the case of interpreter, the syntax errors will be detected during execution and displayed it line by line.
Eg. Missing of semicolon(;) in a statement.
(b). Logical error : It is caused by incorrect program logic. We get output, but it may not be the desired
result. This error should be identified by the programmer. Eg. s=a+b instead ofs=a-b.
(c) Run time error : It is the unexpected errors due to critical conditions such as overflow caused due to
division by zero.
Eg. a= b/c. When c= 0, there is an error message, which is a run time error.
25. What do you mean by comments in C++? Briefly explain two types of comments in C++:
Answer:
Comments: Comments are statements in a program that are not executed but provide information or
explanation about the code.
Types of Comments:
1. Single-line Comment: Starts with // and continues until the end of the line.
Example: // This is a single-line comment.
2. Multi-line Comment: Starts with /* and ends with */, used for longer explanations.
Example:/* This is a multi-line comment*/
26. Write a C++ program to find the area and perimeter of a rectangle
Answer:
#include <iostream>
using namespace std;
int main()
{

PREPARED BY MENOUP T, THARAKAN HSS ANGADIPURAM, MALAPPURAM


float length, breadth, area, perimeter;
cout << "Enter the length and breadth of the rectangle: ";
cin >> length >> breadth;
area = length * breadth;
perimeter = 2 * (length + breadth);
cout << "Area of the rectangle: " << area;
cout << "Perimeter of the rectangle: " << perimeter;
return 0;
}
27. Write short notes on the following:
(a) Bubble Sort:
Answer: A sorting algorithm that repeatedly swaps adjacent elements if they are in the wrong order. It
continues until the list is sorted.
(b) Selection Sort:
Answer: A sorting algorithm that selects the smallest (or largest) element from the unsorted part of the
list and swaps it with the first element of the unsorted part.
(c) 2D Arrays:
Answer: A two-dimensional array is a collection of elements arranged in rows and columns.
Example: int matrix[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
28. Compare linear and binary search:
Answer:
Linear Search (Sequential Research)
• Linear search or sequential search is a method for finding a particular value in a list.
• Linear search consists of checking each element in the list, starting from the first element until the
desired one is found (successful) or the end of list is reached (unsuccessful).
Binary Search
• This search is performed on a sorted array.
• It checks the middle element, eliminates half of the list from consideration and proceeds with the other
half.
• If the middle element is the searched value, position is found, otherwise upper half or lower half is
chosen for search based on whether the searched value is greater or less than the middle element.

29. Briefly explain any three stream functions for I/O operations used in C++:
Answer:
get( ) - used to input a single character or stream of characters
Header file : iostream
Syntax : cin.get(variable) ; cin.get(array name , size) ;
Eg: cin.get(ch) ; // accepts a single character
getline( ) - used to input a string
Header file : iostream
Syntax : cin.getline(array name , len) ;
Eg : cin.getline(str,10);
put( ) - used to display a character
Header file : iostream
Syntax : cout.put(variable or character constant) ;
Eg : char ch='B' ;
cout.put(ch) ;

PREPARED BY MENOUP T, THARAKAN HSS ANGADIPURAM, MALAPPURAM


5-Mark Questions (Answer any 2)

30. (a) Define the term operating system. Name any two of its functions:
Answer:

Operating system: Set of programs that act as an interface between the user and computer hardware.
Example:- DOS, Windows, Unix, Linux
Functions:
o Memory management.
o Process management
(b) Explain briefly different types of language processors:

Answer:
Assembler: Converts assembly language into machine language.
Interpreter: Converts a high level language program into machine language line by line.
Compiler: Converts the whole high level language program into machine language at a time.

31. (a) Write an algorithm to print the numbers from 1 to 100: (b) Draw its Flowchart:
Answer:

1. Start
2. N=1.
3. Repeat steps 4 and 5 until N<=100.
4. Print the value of N.
5. Increment N by 1.
6. Stop

32. (a) Which are the four components of a loop in C++?


Answer:
1. Initialisation: The loop control variable (Variable used in the condition) gets its first value. The initialisation
statement is executed only once, at the beginning of the loop.eg. i=1

PREPARED BY MENOUP T, THARAKAN HSS ANGADIPURAM, MALAPPURAM


2. Test expression: It is a relational or logical expression whose value is either True or False. It decides whether
the loop-body will be executed or not. If the test expression evaluates to True, the loop-body gets executed,
otherwise it will not be executed. eg. i<=10

3. Update statement: The update statement modifies the loop control variable by changing its value. The update
statement is executed before the next iteration. eg. i++
4. Body of the loop: The statements that need to be executed repeatedly constitute the body of the loop.
eg. cout<<i;

(b) Differentiate between entry-controlled loop and exit-controlled loop:


Answer:

Exit-Controlled Loop
Entry-Controlled Loop
The condition is checked after executing the loop
The condition is checked before executing the loop body.
body.
for and while loops do-while loop
Executes at least once, even if the condition is false
May not execute if the condition is false initially.
initially.

PREPARED BY MENOUP T, THARAKAN HSS ANGADIPURAM, MALAPPURAM

You might also like