Quiz 2 and Solutions

Quiz 2 and Solutions - Computer Techniques for Electronic...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Computer Techniques for Electronic Design II (ESE 224) Quiz for chapter 2 Period: 10 minutes 1. Which of the following declarations would properly define a, b, c as integers? a) int a, b, c; b) long int a, b, c; c) double int a, b, c; d) int a=b=c; e) int A, B, C 2. Which of the following x would be equal to 5? a) Int x(3), y(1); y += ++x; b) y = 4; x = ++y; c) x = 2; x += 3; d) y = 5; z = 3; x = y = z; e) y = 2; y += x + 3; 3. Which of the following is a C++ keyword but not a C keyword? a) Const b) Using; c) Static; d) When e) Unsigned 4. Which of the following statement about C++ is Correct? a) There could be more than one main function in a C++ program. b) C++ is case insensitive; c) Declarations must be placed at the beginning of a function. d) The result of an integer division is a rounded result. e) Statement and declarations must end with a semicolon. 5. Write down the output: #include <iostream> Using namespace std; Int main() { int a1, a2; char b1, b2; cin >> a1 >> b1; b2 = a2 = a1 + b1; cout << a2 << b2 << endl; return 0; } Suppose we choose 2, 3 as the input. ASCII code values of ‘0’ to ‘9’ are 48 ~ 57 Solutions 1. a, b, d 2. b, c 3 . b 4. e 5. 53, 5 ...
View Full Document

This note was uploaded on 10/23/2011 for the course ECE 224 taught by Professor Wangxin during the Spring '09 term at SUNY Stony Brook.

Ask a homework question - tutors are online