Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - As a result of running the following program,
As a result of running the following program,
Question 1: The running result of the following program is. You don't understand this sentence, do you?

for(I = 0; ch[I]& gt; = ' 0 ' & amp& ampch[I]= ' 0 ' & amp; & ch [i] Question 2: 50. The running result of the following program is ....................... () char c [5] = {'a',' b',' \ 0', and the answer to' c' is B.

Because \0 ends when outputting %s, and C points to c[0], c[0] and c[ 1] are output, and c[2] ends because it is \0.

Question 3: The running result of the following program is (). Choose B. In a=d/ 100%9, carry out arithmetic operation first, from left to right, d/ 100=2, because D is an integer and 100 is an integer, so the result is shaping, and the decimal will be ignored. 2 Find the remainder of 9, and the quotient is 0 and 2. Then assign a value, and A gets 2.

b =(- 1); & (-1),-1 and-1are true. Because (-1)=(- 1), the logical judgment is true and the value is 1. If you assign the value again, b will get 1.

I hope it helps you.

Remember to adopt

Question 4: How does the following program work? Take one character at a time from the ch array.

Take' 6' for the first time,' 0' for the first time and' 0' for the third time.

Use s =10 * s+ch [a]-0 when splicing; Subtract' 0' and convert it into an integer, such as' 6'-'0' = 6; Every multiplication by 10 is a carry.

The specific process is as follows

s = 10 * 0+' 6 '-' 0 ' = 6;

s = 10 * 6+' 0 '-' 0 ' = 60;

s = 10 * 60+' 0 '-' 0 ' = 600;

Question 5: What is the result of the following procedure? Why? 10 point 1. C

Subclasses re-implement virtual functions.

2. "BC" constructor

DC constructor

DC Deconstructor

Destructor function of BC

The order of inheritance class construction is first parent class and then subclass, while the order of destruction is the opposite.

3. There will be a compilation error (are you sure you wrote it correctly? )

The function is not declared, even if it is declared, there will still be a warning (it is best to declare the original array as const char* pn[], and the corresponding function parameter types will change).

4. D::func () was called.

Subclasses re-implement virtual functions.

Question 6: When the following program is running, if the character A is input, the output result is _ _ _ _ .85-10070-8460-69 failure.

The ascii value of a is 65, so it is executed from top to bottom. Because each case is uninterrupted, it needs to be re-executed.

Question 7: The output of the following program is: n[j]=n[t]+ 1, that is, the value of n[t] plus 1 is assigned to n[j].

The first cycle:

for(t = 0; T Question 8: The execution result of the following procedures is _ _ _ _ _ _ _. B)i=4,j=3

I = sizeof(a); A can hold four characters.

j = strlen(a); The length of the string is 3.

Question 9: What is the result of the following procedure? Why? Because the constructor calls the base class first, and then the subclass. The destructor calls the subclass first and then the base class, so the output is:

B b outputs in the class library (the constructor of the base class is called first), and then outputs in the class library (the constructor of the derived class A), while the constructor of B has no extra output.

b . fc(); Class b output

Base * p = new a; Output in the class library (first call the constructor of the base class), and then output in the class library (constructor of derived class A).

p->; fc(); Output (output of derived class) in class base, factor class A does not cover FC () of the base class [I'm not sure if it's misspelled as f()].

Delete p; Because the destructor does nothing, it outputs a destructor base class object (the destructor of the base class).

End of program: output destructor B object, and then output destructor base object.

Question 10: The running result of the following program is: (). main()k = 1; k= 1k