Beruflich Dokumente
Kultur Dokumente
Time: 3:00-4:15PM
STUDENT NAME
STUDENT ID #
SECTION #
Question #
MARKS
10
10
12
TOTAL
40
COMMENTS
Page 1 of 6
b- ( 11011001 )2 = (
)16
)10
c- ( CB7 )16 = (
)8
Page 2 of 6
Question 2 (8 Points)
What is the output of the following codes?
(1) Suppose the user input is:
BSc Computer Science
Equals 132 Credits
char c;
string w1, w2;
int n;
cin>>c;
getline(cin, w1);
cin>>w2>>n;
cout << w2 << "\n" << n << endl;
cout << c << "\t" << w1;
(2)
int x=4, y=3, k=10;
cout << ( x + k/y y/k*10 ) << endl;
cout << ( ++x * 3 ) << endl;
cout << y-- << endl;
cout << x << "\t" << y << endl;
(3)
int A= 12;
float B= 1.546, C= 95.4803;
cout
cout
cout
cout
cout
<<
<<
<<
<<
<<
Page 3 of 6
Page 4 of 6
SAMPLE INPUT/OUTPUT
input.txt (input file)
4.0
3.0 10.0
Screen Output
The Volume of Triangular prism
is 60.00
Page 5 of 6
Page 6 of 6