All Exams
Login
Home
Exams
C++ Institute
CPA-21-02
Question 6 of 40
The following declaration:
int i = 0b10;
A.
is invalid
B.
sets variable i with an integer value equal to 10
C.
sets variable i with an integer value equal to 2 (10 binary)
D.
sets variable i with an integer value equal to 8 (10 octal)
Answer
Discussion
Correct Answer: C
Question 7 of 40
The following declaration:
int i = 010;
A.
sets variable i with an integer value equal to 10
B.
sets variable i with an integer value equal to 2 (10 binary)
C.
is invalid
D.
sets variable i with an integer value equal to 8 (10 octal)
Answer
Discussion
Correct Answer: D
Question 8 of 40
Which of the following operators accept integer arguments only? (Choose two.)
A.
|
B.
| |
C.
~
D.
!
Answer
Discussion
Correct Answer: A, C
Question 9 of 40
Which of the following expressions decrement variable i by 2? (Choose two.)
A.
i &= 0x03;
B.
i –= 2;
C.
––i; i––;
D.
––i––;
Answer
Discussion
Correct Answer: B, C
Question 10 of 40
What happens when you attempt to compile and run the following code?
A.
It prints: 1
B.
It causes a compilation error
C.
It prints: –1
D.
It prints: 0
Answer
Discussion
Correct Answer: B
Prev page
Prev
Next page
Next