"Learning the path of iOS: C language" C language error-prone questions collation.

Source: Internet
Author: User
Tags arithmetic operators

Note: This type of question is a relatively basic question, but it is easy for people to ignore, or usually do not care.


1. The value of the expression 3.6-5/2+1.2+5%2 is (D).

A. 4.3 B. 4.8 c.3.3 D. 3.8


2. With description: Char w;int x;float y;double z; The data type of the expression w*x+z-y value is: (D)

A. Float B. Char C. int D. Double


3. The following description of operator precedence is correct: (C)

A. Relational operators < arithmetic operators < Assignment operators < logic and operators B. Logic and operators < relational operators < arithmetic operators < Assignment operators

C. Assignment operators < logic and operators < relational operators < arithmetic operators D. Arithmetic operators < relational operators < Assignment operators < logic and operators


4. With definition: int k=0; The four expressions of the following options differ from the values of the other three expressions: (A)

A. k++ B. k + = 1 C. ++k D. k + 1


The basic unit of the 5.C language source program is: (B)

A. Procedure B. function C. subroutine D. identifier


6. The output of the following program is: (D)

Main ()
{
int k=17;
printf ("%d,%o,%x", k,k,k);
}a.17 021 0X11 B. C. 0X11 021 d.17 21 11
7. The following description of the error is: (C)The # include and # define lines in the A.C program are not c statements.B. The assignment operator has the lowest precedence except the comma operatorC.C program, "J + +;" is an assignment statementthe D.C program compiles and connects the steps to form a truly executable binary machine instruction file.
8. The value of sum after the following program execution is: (C)
Main ()
{
int i,sum;
for (i=1;i<6;i++) sum+=i;
printf ("%d", sum);
}a.15 b.14 C. Uncertainty d.0
9. Set I and k are all int types, then the FOR Loop statement: for (i=0,k=-1;k=1;i++,k++) printf ("* * *");(D)

A. The condition of the end of the loop is not legal B. The loop body does not execute at a time C. The loop body executes only once D. is an infinite loop


10. Set int x=1, Y=1; An expression (!x| | y--) The value is (B)

A. 0 B. 1 C. 2 d.-1


11. The output of the following program is: (A)

#define ADD (x) x*x
Main ()
{
int A=4,b=6,c=7,d=add (a+b) *c;
printf ("d=%d", D);
}

A. D = B. D = C. D = d = 700


12. Use a macro to find the maximum value in three numbers, and the macro definition is correct (a)

A. #define MAX (A,b,c) ((a) > (b)? ( A):(B)) >c? ((a) > (b)? (a):(B)):(C)

B. #define MAX (A,b,c) (A>B?A:B) >c? (A>B?A:B): C

C. #define MAX (A,b,c) (a) > (b)? (a):(B) >c? ((a) > (b)? (a):(B)):(C)

D. #define MAX (a,b,c) a>b?a:b>c? (A>B?A:B): C


13. There are the following procedures

Main ()
{
Char s[]= "ABCD", *p;
for (p=s+l; p < s+4; p++)
{
printf ("%s", p);
}
}
The output of the program is: (D)

A. ABCD BCD CD D B.  A B c D c. B C D d. BCD CD D


14. The address of a variable is called a pointer to the variable (√)

15. Recursive invocation of a function is simply a function that invokes itself directly or indirectly. (√).Any expression statement is composed of an expression plus a semicolon. (√)
17. There is the following procedure main () {

Char p[]={' A ', ' B ', ' C '},q[]= ' abc ';

printf ("%d%d\n", sizeof (p), sizeof (q));

};

After the program runs and the output is (C)

A. 4 4 B. 3 3 c. 3 4 D. 4 3



"Learning the path of iOS: C language" C language error-prone questions collation.

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.