SYCS-135� Introduction to Programming

 

Quiz 8 - 11/9/99

 

Name:� ____Solution_________________�� ID:� __________________������������������� ������������������������������� �������������������������������

 

�

��������������� _D__ 1.��������������� [3] Why is it important to know which particular character set your computer uses?

 

��������������� A)��������������� Algorithms that work with one character set may not work

������������������������������� ��� with another (for example, an algorithm that converts a

������������������������������� ��� lowercase letter to an uppercase letter).

��������������� B)��������������� The same character may have different integer

������������������������������� ��� representations in different character sets.

��������������� C)��������������� The collating sequences of different character sets may not

������������������������������� ��� be the same.

��������������� D)��������������� a, b, and c above

 

 

2.������������ [2] A(n) ___enumeration type____ is a user-defined data type whose domain is an ordered set of literal values expressed as identifiers.

 

 

��������������� _A__ 3.��������������� [2] The C++ statement

�������������������������������

������������������������������� � alpha /= beta + 25;

�������������������������������

������������������������������� � is equivalent to the statement

�������������������������������

������������������������������� � alpha = alpha / (beta + 25);

 

��������������� A)��������������� True

��������������� B)��������������� False

 

 

��������������� 4.��������������� [3] Using a while statement, write equivalent code to the following for statement:

 

��������������� ���� for statement��������������� |�������������� ��������������� while code

_____________________________________________________________������������� ��������������� ��������������� ��������������� ���������������

for (int jj = 1; jj < 8; jj++)��� ��������������� |��������������� int jj = 1;

��������������� cout << jj*jj;������� ��������������� |��������������� while (jj < 8)

��������������� ��������������� ��������������� ��������������� |��������������� {

��������������� ��������������� ��������������� ��������������� |�������������� ��������������� cout << jj*jj;

��������������� ��������������� ��������������� ��������������� |�������������� ��������������� jj++;

������������������������������� ������������������������������� ��������������� ��������������� }