# Plus One Computer Science Model Question Paper 2

## Kerala Plus One Computer Science Model Question Paper 2

Answer all question from 1 to 5

Question 1.
Abacus was discovered by the ………..

Question 2.
The name given to a storage location is known as ……………

Question 3.
………………….. statement takes the program out of the loop even though the test expression is true.

Question 4.
Name the header file required for a us­ing console I/O function.

Question 5.
Write the full form of FTTH.

Answer any nine questions from 6 to 16

Question 6.
On what factors, the action of the Turing machine depends?

Question 7.
Express the integer number -39 in sign and magnitude representation.

Question 8.
What is a control unit?

Question 9.
“It is better to give proper documenta­tion within the program”. Give a rea­son.

Question 10.
Mention the purpose of tokens in C++. Write names of any four tokens in C++.

Question 11.
What is a variable? List the two values associated with it.

Question 12.
Declare an array of size 5 and initialize it with the number 8, 7, 2, 4 and 6.

Question 13.
Consider the following C++ statements:

char word [20];
cin>>word;
cout<<word;
gets (word) ;
puts (word) ;
If the string entered is “HAPPY NEW YEAR”, predict the output and justify your answer.

Question 14.
What will be the output of the state­ment?

Question 15.
a. Define Intranet.

b. Write the structure of an email ad­dress.

Question 16.
How does a Trojan horse affect a com­puter?

Answer any nine questions from 17 to 27.

Question 17.
Fill in the blanks:

a. (o.625)10 = (……………. )2
b. (38o)10 = (………. )16
c. (437)8 = (………………………… )2

Question 18.
What are the methods of representing characters in computer memory?

Question 19.
Differentiate between freeware and shareware.

Question 20.
Write a C++ program to accept an in­teger number and print its reverse. (Hint: If 234 is given, the output must be 432).

Question 21.
What are the limitations of a flow-chart?

Question 22.
Raju wants to add value 1 to the vari­able ‘p’ and store the new value in ‘p’ itself. Write four different statements in C++ to do the task.

Question 23.
Compare and discuss the suitability of three loops in different situations.

Question 24.
Define an array. Also, write an algo­rithm for searching an element in the array using any one method that you are familiar with.

Question 25.
Write a program to find the sum and average of elements in a 2D array.

Question 26.
Write a program for swapping the val­ues of two variables.

Answer any two questions from 28 to 30

Question 27.
Write a program to combine two strings if they are different and find its length.

Question 28.
Briefly explain various types of memory

Question 29.
Explain the different jump statements available in C++.

Question 30.
How are computer network classified based on size?

Mesopotamians

variable

break

Stdio.h

Fibre To The Home

The action of a Turing machine is de­termined by:

• the current state of the machine.
• the symbol in the cell currently be­ing scanned by the head.
• a table of transition rules, which serve as the ‘program’ for the machine.

The number is negative, so a first bit (MSB) is 1
7-bit binary equivalent of 39
= (100111)2
So -39 can be written as (1100111)2

Control unit (CU) is responsible for ac­tivating and controlling the operations of the units of the computer. Each of the functional units has its own func­tion, but none of these will perform the function until it is asked to, this task is assigned to the control unit.

Documentation is an on-going process. that starts in the problem study phase of the system and continues till its implementation and operation. We can write comments in the source code as part of the documentation. It provides suffi­cient information in a program to un­derstand its working. If the program is documented, it helps to understand the logic we applied. It helps the debugging process as well as a program modification at a later stage.

Tokens or lexical units are the funda­mental building blocks of the program. C++ has five types of tokens. They are keywords, identifiers, literals, punc­tuators, and operators.

Variables are the names given to memory locations. There are two values associated with a variable. They are R-value and L-value. The R-value represents the data and L­value represents the memory address of the variable.

int A[5];
A[5] = {8, 7, 2, 4, 6};
OR
int A[5] = {8, 7, 2, 4, 6};

The output will be,
HAPPY
HAPPY NEW YEAR
Because cin statement reads till a whi­te space. But the function gets( ) is a con­sole input function used to accept a string of characters including white spaces from the standard input device (keyboard).

It displays ‘a’ on the screen. If an inte­ger value is given as the argument, it will be considered as an ASCII value and the corresponding character will be dis­played.

a. A private network inside a company or organisation is called intranet.
b. The structure of an e-mail address is, user-name@domainname
eg., vinu@gmail.com Here username is vinu domain name is gmail.com

It appears as a useful software but it is a harmful software and it will delete useful software or files. They allow malicious user access to confidential and personal information in the computer through the network without the knowledge of the user.

Characters are representing as binary codes in computer memory. Various codes are ASCII (American Standard Code for Information Interchange), EB­CDIC (Extended Binary Coded Decimal Interchange Code), ISCII (Indian Stan­dard Code for Information Interchange/ Indian Script Code for Information In­terchange) and Unicode.

Freeware refers to copyrighted com­puter software which is made available for use free of charge for an unlimited period. In these, all the features are free. Shareware refers to commercial soft­ware that is distributed on a trial basis. It is distributed without payment and with limited functionality. All the fea­tures are not free.

#include <iostream>
using namespace std; int main( )
{
int num, c, digit, rev=o;
cout<<“Enter the number: ";
cin> >num;
c = num;
while(num != o)
{
digit = num % 10;
rev = (rev * 10)+ digit;
num = num/10;
}
cout<<“The reverse of the number is”
< <rev;
return o;
}

1. Flowcharts are very time consum­ing and laborious to draw with proper symbols and spacing.
2. Owing to the symbol-string nature of flowcharting, any change or modifi­cation in the logic of the algorithm usu­ally requires a completely new flow­chart.
3. There are no standards determining the amount of detail that should be in­cluded in a flowchart.

p = p + 1;
p+ + ;
++p;
p+=i;

for loop:

1. Entry controlled loop.
2. Initialization along with loop defini­tion.
3. No guarantee to execute the loop body at least once.

while loop:

1. Entry controlled loop.
2. Initialization before loop definition.
3. No guarantee to execute the loop body at least once.

do….while loop:

1. Exit controlled loop.
2. Initialization before loop definition.
3. Will execute the loop body at least once even though the condition is False.

An array is a collection of elements of the same type placed in contiguous memory locations.
Algorithm for Linear search
Step 1: Start
Step 2: Accept a value in N as the num­ber of elements of the array
Step 3: Accept N elements into the ar­ray AR
Step 4: Accept the value to be searched in the variable ITEM
Step 5: Set LOC = -1
Step 6: Starting from the first position, repeat Step 7 until the last element
Step 7: Check whether the value in ITEM is found in the current position. If found then store the position in LOC and Go to Step 8, else move to the next posi­tion.
Step 8: If the value of LOC is less than o then display “Not Found”, else display the value of LOC + 1 as the position of the search value.
Step 9: Stop

#include <iostream>
#include <cstdlib> using namespace std; int main()
{
int m, n, i, j, s = o, A[io][io]; float avg;
cout<<“Enter the order of matrix:”;
cin>>m>>n;
cout<<“Enter the elements of matrix\n”;
for (i=o; i<m; i++)
{
for (j=o; j<n; j++) cin > > A[i] [j ];
}
for (i=o; i<m; i++)
{
for (j=o; j<n; j++) s = s + A[i][j];
}
avg = s/(m*n);
cout<<“Sum of the elements of matrix:”<<s;
cout<<“Average of the elements of matrix:”< <avg;
}

#include <iostream>
using namespace std; "
void swapfint & x, int & y)
{
int t = x;
x = y;
Y = t;
}
int main()
{
int m, n; m = 10; n = 20;
cout<<“Before swapping m= ”<< m <<“ and n= ”<<n; swap(m, n);
cout<<“\nAfter swapping m= ”<< m <<“ and n= ”<<n; return o;
}

#include <iostream>
#include <cstring>
using namespace std;
int main( )
{
char s1[2o], s2[2o], s3[2o];
cout<<“Enter two strings: ”;
cin>>si>>s2;
int n=strcmp(s1, S2);
if (n= = o)
cout<<“\nThe input strings are same”;
else
{
cout<<“\nThe input strings are not
same”;
strcpy(s3, s1);
strcat(s3, S2);
cout<<“\nString after concatenation is: ”<<S3;
cout<<“\nLength of the new string is” j
<<strlen(s3);
}
return o;
}

Memory is a place where we can store data, instructions, and results in temporarily or permanently. Memory can be  classified into two:
1. Primary memory: Also refers to the main memory. It holds data, intermediate results and results of ongoing jobs; temporarily. This includes mainly; three types of memory.

i.RAM (Random Access Memory): The microprocessor can read from and write to. The contents of RAM are lost when power is switched off. Therefore, RAM is a volatile memory.

ii. ROM (Read Only Memory): It can perform only read operations and its contents cannot be easily altered. ROM is non-volatile; the contents are retained even after the power is switched off. It is used to hold boot up program is known as Basic Input Output System (BIOS). This software runs when the computer is switched on or ‘boots up’. Different types of ROM are PROM (Programmable ROM), EPROM (Erasable Programmable ROM), EEPROM (Electrically Erasable Programmable ROM)

iii. Cache memory: It is a small and fast memory between the processor and RAM. Frequently accessed data, instructions, intermediate results, etc. are stored in cache memory for quick access. Cache is more expensive than RAM.

iv. Secondary memory: Also known as auxiliary memory. It holds data and information permanently. Various devices in this type are a magnetic storage device (magnetic tape, hard disk), an optical storage device (Compact Disc (CD), Digital Versatile Disk (DVD), Bluray DVD), semiconductor memory (USB flash drive, flash memory cards).2 9. The statements that facilitate the transfer of program control from one place to another are called jump statements.
They are:

• return statement: It is used to transfer control back to the calling program or to come out of a function.
• goto statement: It can transfer the program control to anywhere in the function. The target destination of a goto statement is marked by a label, which is an identifier.
• break statement: When a break statement is encountered in a program, it takes the program control outside the immediately enclosing loop (for, while, do…while) or switch statement. Execution continues from the statement immediately after the control structure.
• continue statement: It is used for skipping over a part of the code within the loop-body and forcing the next iteration. The break statement forces termination of the loop, but continue statement forces next iteration of the loop.
• exit() function: It terminates the pro­gram itself. And can be used in a pro­- gram only if we include the header file process.h.