Practice Test GR 11
Practice Test GR 11
Practice Test GR 11
Python
Test 1
1. a. Write the types of C++ operators ( Arithmetic, logical, relational operators) from the following: [2]
i. ! ii. != iii. && iv. %
b. Observe the following program very carefully and write the name of those header file(s), which are essentially
needed to compile and execute the following program successfully: [1]
Void main ( )
{ char text[20], newText[20];
gets(text);
strcpy(newText,text);
for(int i=0;i<strlen(text);i++)
if(text[i] = =’A’)
text[i] = text[i]+2;
puts(text); }
c. Underline the errors in the following code and write the corrected one. [3]
i. #include<iostream.h>
main( )
{ int choice;
cin >> choice;
switch choice;
case ‘1’ cout >> choice++: break;
case ‘2’ cout>> --choice : break;
}
d. Given the following code fragment: Write an alternative code using if else if ladder. [2]
if (a == 0)
cout << “ZERO”;
if (a == 1)
cout << “ONE”;
if (a == 2)
cout << “TWO”;
if (a == 3)
cout << “THREE”;
else
cout<< “NOT A VALID INPUT”;
e. Find the output of the following program: [2]
int z = 4 , x = 3 , y = 2 , Z;
z+=1;
x = x+1;
y = y-1;
Z = z + x + y;
cout<<Z;
f. Differentiate between ‘ = ‘ and ‘ == ‘. [2]
2. a. Differentiate between Primary memory and secondary memory. [2]
b. Convert the following as directed. [4]
i. (25)10 = ( )2 ii. (A0D)16 = ( )10 iii. (537)8 = ( )2 iv. (11010)2 = ( )10
c. Write the 2’s compliment of the following. [2]
i. 45 ii. 120
d. Differentiate between Assembler, compiler and interpreter. [3]
e. Write the full form of the following: [2]
i. ASCII ii. ISCII iii. ALU iv. POP
3. a. Briefly explain the Basic architecture of a computer? [2]
b. Differentiate between if and switch. [3]
c. Define Infinite loop with example. [2]
d. Write a function to swap two variables without using third variable. [2]
e. Write a function to print the sum of each row of a matrix. [3]
4. a. WAP to arrange the array in descending order. [4]
b. WAP to perform Binary search in an array. [4]
c. WAP in C++ to add two distances in feet and inches using structures. [3]
5. a. WAP in C++ to concatenate two strings. [3]
Example: String 1 = Computer
String 2 = Science
New String = Computer Science
b. WAP in C++ to count the number of vowels in a string. [3]
c. WAP in C++ to read the record of a student and compute and display total marks and grade according to the
criteria given below using structures: [4]
Total Marks Grade
<100 D
>=100 & <200 C
>=200 & <300 B
>= 300 A
6. a. Perform Bubble sort using iteration method on the following array values. [2]
A[ ]= {5,2,8,6,1,12,0,7}
b. Define a structure for the following: [2]
i. Name - fname, lname
ii. House - flatno., pocket
iii. House - colony, city, state
c. WAP to reverse an array. [2]
7. a. WAP to print the maximum and minimum value in an array. [3]
b. WAP to merge two arrays. [3]