2 C level 2 questions, I hope the master will solve them

Updated on educate 2024-04-17
8 answers
  1. Anonymous users2024-02-07

    The last two questions are the data structures, "Look at the book."

    1. x=3,5,7……

    x%2=1 So select d d term expression error false returns a value of 0 note b he is a declarative sentence.

    Regardless of the value of x, the value of the expression is true, and 12A queue is a linear structure, like a chain, that links elements together in a line, and a nonlinear structure has.

    Collections (scattered, with no connection between elements).

    tree (divergent, one-to-many, obviously nonlinear).

    Figure (looks messy, many-to-many).

    It can be understood that being a map linear is one-to-one.

    3.The memory storage method of the sequential storage structure is that the physical location is separated, as long as the starting position is determined, the element can be read and written arbitrarily, and the linked list is different, it can be vividly considered that it is a chain strung together by a pointer, and there is no connection between the physical position in memory, only a logical connection, and the operation on the linked list can only be slid down along the pointer to find the location of the operation.

  2. Anonymous users2024-02-06

    1.The value is 0, sometimes it can be false, only d, x%2 must be 1 instead of 0

    2.Linear structure refers to the representation that logically can be visualized by the concept of line. A queue with a chain is like a knot.

    3.Refer to the second question, compare the two structures of the linear table, and understand it yourself.

  3. Anonymous users2024-02-05

    The meaning of the above question:

    When both *t and *s are empty, and the t string is equal to the s string, return*t-*s (that is, 0), so if the function returns 0, it means that the size of the two strings is the same, so choose b

    The meaning of the following question is:

    while*s is not null, if *t is also not null, the value of t is assigned to s, so the string t is copied to the string s.

  4. Anonymous users2024-02-04

    1. C++ functions are passed by value. There is no value assigned to val in main, so the value is uncertain. When calling the function, the val variable in the function is actually a copy of the main function val, and the value of val in the function will not change the value of val in main.

    So the answer should be d

    2、void function(double val);is a declaration of a function. In C++, if the function definition is after the function that is used, the function needs to be declared at the beginning of the function. The function function is defined after main, so you need to declare the function function in main first.

  5. Anonymous users2024-02-03

    In the main function, void function(double val) declares a local function, that is, the function can only be called in the main function; There's nothing wrong with that. The double val in parentheses is the parameter and val is the name of the parameter, which can be omitted here, i.e., declared as: void function(double).

    main; val is a variable but not assigned, so it is an indeterminate number; function(val); It is to call the function with the variable val as a practical argument; Since the parameter pass is one-way, that is, when calling the function, an indeterminate number val is passed to the form parameter val (the two vals are in different places in memory, but they have the same name, because the scope is different, the same name is allowed), and the form parameter val is modified to 3 in the function, but the real parameter val (that is, the variable val in the main function does not change, that is, the parameter transfer is one-way), therefore, the output val is still an indefinite number.

  6. Anonymous users2024-02-02

    void function(double val);It is a function declaration, val can be desired or not, and if it does, it must be consistent with the function header that implements the function.

  7. Anonymous users2024-02-01

    The answer is b, first of all, you have to understand the meaning of comma expressions to grasp it.

    Comma expressions: For example, (Expression 1, Expression 2), it will eventually return the value of the second expression, which is Expression 2.

    Therefore, in a, first execute the statement y=z=8 in parentheses to get y==8, z==8, then execute 4*6 to get 24, and the expression returns the value on the second expression, which is 24, so x==24.

    In the same way, we get in b, z==8, x==24, y==24c, x==8, y==8, z==8

    d can be put. x=(y=z=8) is considered as expression 1, 4*6 is regarded as expression 2, so the whole statement x=(y=z=8), 4*6; The return value is 24...So execute Expression 1 first to get x==8 y==8 z==8

  8. Anonymous users2024-01-31

    Parentheses are taken precedent, and comma expressions are from left to right.

    A is x=24 and y=z=8

    b is x=y=24, z=8

    c is x=y=z=8

    d is x=y=z=8

Related questions
16 answers2024-04-17

The output of this program is: 4

You can standardize the program to make it easier to understand. >>>More

6 answers2024-04-17

It's not difficult, I didn't pass the written test for the first time, but it's just 60 on the computer, as long as you are careful, because you can at least know the right and wrong of the program on the computer.

4 answers2024-04-17

If you have a book, just buy one yourself, and before each second-level exam, there are exam questions to refer to, 100% of which are inside, and there are many questions.

19 answers2024-04-17

I'll take the exam in July, hehe. However, now I have more than 280 points in the questions, and there is no big problem in passing. >>>More

11 answers2024-04-17

I took level 2 last year.

Generally, the papers will be sent in advance, but before the time starts, it is certain that you will be 5 minutes in advance, because before the exam, you have to send out all the papers and answer sheets, and you have to write a lot of names and test numbers. But be careful!! I won't let you open the volume until the start time. >>>More