306-135� Introductory Programming with C++

 

Quiz 2 - 9/9/99

 

Name:� ������� Solutions�����������������������

 

 

1.� Circle all the valid C++ identifiers in the following list.

 

dfg������������� 2pq.r���������� tax-rate������� ��� INCLUDE�������� ��� state_4

 

2.� Circle all the valid constants on the following list:

 

�bv������������� -99������������� abc.1���������� ��� 2.6���������� �� 14,305

 

3.� Write down 2 special C++ symbols that are one character in length.

 

���������������������������� +, - , /, *, < , >, etc.

 

4.� What will be printed out when the following C++ program executes:

 

#include <iostream.h>

int main ()

{

��������� int a, b;

��������� float f, g;

��������� b = 2;

��������� f = 2.6;

��������� a = f * 2;

��������� g = f + 5 / b;

��������� cout << �a = � << a << endl << � g = � << g;

��������� return 0;

}

 

Answer:����� ��������� a = 5���������������������������������������������������������������������������������������

������������������ ��������� g = 4.6������������������������������������������������������������������������������������

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