C ++ basic learning notes (1) --- data types and expressions (test questions)

Source: Internet
Author: User

I. multiple choice questions

1. Which of the following data is invalid is (C ).

(A) 0.123 (B) 123e3 (C) 2.1e3.5 (D) 789.0

2. If there is a definition:

Int a = 7; float x = 2.5, y = 4.7; then the value of expression x + a % 3 * (int) (x + y) % 2/4 is ().

(A) 2.500000 (B) 2.750000 (C) 3.500000 (D) 0.000000

3. If the variable a is of the int type, f is of the float type, and I is of the double type, the expression 10 + 'A' + I * f value is of the data type.

Is (C ).

(A) int (B) float (C) double (D) uncertain

4. In the bitwise operation, the operand shifts one bit left, and the result is equivalent to ().

(A) operand multiplied by 2 (B) operand divided by 2

(C) operands divided by 4 (D) operands multiplied by 4

5. If the following statements are provided, the statement (B ).

Char s = 92;

(A) if the value of s contains 1 character (B), the description is invalid and the value of s is uncertain.

(C) Make the value of s contain four characters (D) so that the value of s contains three characters

6. If kl, k2, k3, and k4 are all int-type variables, in order to assign integer 10 to kl and k3, assign integer 20 to k2

And k4, the correct input method for the following scanf () function call statements is (D) (<CR> indicates a line break

Table space ).

Scanf ("% d", & k1, & l2 );

Scanf ("% d, % d", & k3, & k4 );

(A) 1020 <CR> (B) 10 ㄩ 20 <CR> (C) 10, 20 <CR> (D) 10 ㄩ 20 <CR>

1020 <CR> 10 limit 20 <CR> 10, 20 <CR> 10, 20 <CR>

7. If the variable has been correctly defined and assigned a value, the following expression that complies with the C language syntax is (B ).

(A) a: = B + 1 (B) a = B = c + 2 (C) int 18.5% 3 (D) a = a + 7 = c + B

8. In C/C ++, the logical value "true" is represented by (D.

(A) true (B) number greater than 0 (C) Number of non-0 integers (D) Non-0

9. The following group of user identifiers that can be used for C/C ++ language is (B ).

(A) void, define, WORD (B) a3_b3, _ 123, Car

(C) For,-abc, IF Case (D) 2a, DO, sizeof

10. The invalid expression in the following options is (D ).

(A) 0 <= x <100 (B) I = j = 0 (C) (char) (65 + 3) (D) x + 1 = x + 1

(A) a = 1 (B) ++ I; (C) a = a ++ = 5; (D) a = int (I );

Ii. Read the running results of the program analysis program

11. The result of the following procedure is (B ).

Int a = 21, B = 11;

Cout <(-- a + B) <"," <(-- B + );

(A) 29,28 (B) 31,30 (C) 28,29 (D) 30,31

12. The result of the following procedure is (D ).

Int a = 3, B = 10;

Cout <(a <2 | B> 1 );

(A) 1 (B) 5 (C) 12 (D) 13

13. Run the following program twice. If you input 6 boxes and 4 boxes on the keyboard, the output result is ().

Int main ()

{

Int;

Cin>;

If (a ++> 5) cout <;

Else cout <--;

}

(A) 7 and 5 (B) 6 and 3 (C) 7 and 4 (D) 6 and 4

3. Fill in blank questions

14. If the following statements and statements are provided, the binary number of c is 0001. // The Bytes data occupies one byte, four digits

Char a = 3, B = 6, c; c = a ^ B> 2;

15. If the following statements are provided, the binary number of c is 1000.

Char a = 3, B = 6, c; c = ~ A & B <1;

16. Set a = 00101101. If you want to use the ^ B operation to reverse the 4-bit high of a, and the 4-bit low will not change, the two-step

The number should be 11110000.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.