The author is Xie Enming, an official account of Programmer Union (wechat id: CoderHub). Please indicate the source of reprint. Original: www.jianshu.com/p/3cd80b950…

The whole series of C language Exploration

Content abstract


  1. preface
  2. exercises
  3. Answer to practice questions
  4. Part 2 Lesson 1 Notice

1. Introduction


A lesson is the first part of the C language to explore trip | lesson 11: function.

The first part of the course is over, we must consolidate the knowledge we learned in part 1 before starting the exploration of Part 2.

I’ve got some practice questions for you: 15 multiple choice questions.

The 15 questions (single choice) are provided with answers in this lesson, but you are expected to finish them first before looking at the answers.

Exercises of 2.


1. What is the name of the program responsible for converting source code to binary code? A. speaker B. compiler C. transcoder

2. Which of the following is not an IDE? A.Vim B.Visual Studio C.Code::Blocks D.Xcode

3. Which value is considered false by C as a Boolean value? A.1 B.0 C.-1 D.-2

4. Return 0 in this code; What does it mean?

#include <stdio.h>
int main()
{
    printf("Hello world! \n");
    return 0;
}
Copy the code

A. The program is not running b. The program is not running properly c. The program is running properly

5. Which of the following is a newline character in C? A.\t B. n C. Just press enter on the keyboard

6. If I have a variable bankAccount of type long with a value of 6500000, what does the following code output?

printf("You have % LD $\n in your bank account", bankAccount);
Copy the code

A. Your bank account has % LD yuan in it. B. Your bank account has 6500000 yuan. Your bankAccount has ld yuan, bankAccount

7. Which of the following memory will not be emptied after the computer is turned off? A. register B. cache C. memory D. hard disk

8. What is the value of the result variable after this operation?

result = (8 / 3) - 2;
Copy the code

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

  1. What is the problem with the following switch statement?
switch (variable)
{
    case 5:
        printf("Hello");
    case 12:
        printf("Hello");
    default:
        printf("Goodbye");
}
Copy the code

A. The break statement is missing. B. A semicolon is missing after the last curly brace of switch. C. Use curly braces for each instruction in each case. D. Fault should be written as case default.

  1. Which for loop displays the following information on the screen?
Line n1
Line n3
Line n5
Line n7
Copy the code

A.for (count = 1 ; count < 9 ; count += 2) B.for (count = 1 ; count <= 7 ; count++) C.for (count = 0 ; count < 9 ; count += 2) D.for (count = 1 ; count < 8 ; count++)

11. How many times does the following code display Hello?

int count = 14;
while (count < 15)
{
    printf("Hello\n");
}
Copy the code

A.0 B.1 C.14 D.15 E. This is an infinite loop

12. When is a return statement not required? B. The type of the function is void C. The function must return 0

13. What are the parameters of a function? A. Specify the name of the function B. Specify the return value of the function C. The variable we pass to the function to make it work

14. What is the problem with the following functions?

int square(int number)
{
    int result = 0;
    result = number * number;
}
Copy the code

A. The function does not return any value. B. The function cannot run because we forgot A semicolon C somewhere. No problem at all

15. How many functions can be included in a program? A. Only one, which is the main function b. At most 100 C. A maximum of 1024 D. No limit

3


  1. B
  2. A
  3. B
  4. C
  5. B
  6. B
  7. D
  8. B
  9. A
  10. A
  11. E
  12. B
  13. C
  14. A
  15. D

The questions are not difficult, carefully review will certainly get high marks, you answered all right?

4. Part 2 Lesson 1 Preview


That’s all for today’s lesson, come on!

Next lesson: C exploration trip | in the second part first lesson: modular programming

Next lesson begins with the second part of our exciting series.


My name is Xie Enming, the operator of the public account “Programmer Union” (wechat id: CoderHub), the moOCs elite lecturer Oscar, and a lifelong learner. Love life, like swimming, a little cooking. Life motto: “Run straight for the pole”