⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c1.txt

📁 ssd6选择题1
💻 TXT
📖 第 1 页 / 共 2 页
字号:
1. 	
	Compared to a sequence of machine code instructions, a fragment of C code 	

	(a) does not engage any transistors during its execution
(b) describes the actions of the computer, not just of the CPU
(c) may describe the same algorithm
(d) is the native way to program most computers

	Correct answer is 	(c)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.1.2 of the course notes.
   (c) 	

	2. 	
	Which of the following Visual C++ objects are contained within a "Project"?

   1. Files
   2. Visual C++ Solutions
   3. Flow charts

	

	(a) II only
(b) II and III only
(c) I only
(d) I, II and III

	Correct answer is 	(c)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.1.4 of the course notes.
   (c) 	

	3. 	
	Within Visual C++, which of the following will reveal the value of a variable when the program is stopped at a breakpoint?

   1. Placing the mouse pointer over the variable name in the source file window.
   2. Inserting a printf() in the program.
   3. Typing the variable name on the "Watch" window.

	

	(a) I and III only
(b) III only
(c) I, II, and III
(d) II and III only

	Correct answer is 	(a)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.2.3 of the course notes.
   (a) 	

	4. 	
	Which of the following must be true if a program is stopped at a specific line within the Visual C++ debugger?

   1. There is at least one breakpoint enabled.
   2. There is a breakpoint enabled on that line.
   3. There is a breakpoint enabled on the line preceding that line.

	

	(a) I only
(b) none
(c) I and II only
(d) I and III only

	Correct answer is 	(b)

	Your score on this question is: 	0.00

	Feedback: 	
   See section 1.2.2 of the course notes.
   (c) 	

	5. 	
	Consider the program given below.

    #include 
    int callee(void) {
        int count = 5;
        printf("%d ", (int) &count);
        return count;
    }
    int main (int argc, char *argv[]) {
        int count = 4;
        count = callee();
        printf("%d ", (int) &count);   
        return 0;
    }

Which of the following describes the output of the program? 	

	(a) 5 and 4 are printed, in that order on the same line.
(b) One integer is printed twice, and its value cannot be determined from the information given.
(c) Two different integers are printed, and the value of neither can be determined from the information given.
(d) 5 is printed twice on the same line.

	Correct answer is 	(c)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.4.1 of the course notes.
   (c) 	

	6. 	
	Consider the following function.

    int factorial(int n) {
        if (n == 1) return n;
        return n * factorial(n - 1);
    }

How many activation records are "popped" when it is invoked by the expression factorial(4)? 	

	(a) 1
(b) 4
(c) 0
(d) 5

	Correct answer is 	(b)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.4.2 of the course notes.
   (b) 	

	7. 	
	Consider the following program.

    int i;
    int j = 1;
    int callee(int number) {
        int plusone;
        plusone = number + 1;
        return plusone;
    }
    int main (int argc, char *argv[]) {
        if (j == 1) return callee(i);
        return j;
    }

Which of the following are allocated in the activation record immediately after the function callee() is invoked? 	

	(a) i only.
(b) i, j and number only.
(c) plusone only.
(d) plusone and number only.

	Correct answer is 	(d)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.4.2 of the course notes.
   (d) 	

	8. 	
	Consider the following program.

    int square(int * arg) {
        int n = * arg;
        return n * n;
    }
    int main (int argc, char * argv[]) {
        int arg = strtol(argv[1], NULL, 0);
        return square(arg);
    }

When it is executed with the argument 5, the variable n is allocated to 	

	(a) many addresses chosen by the compiler.
(b) many addresses neither of which are known to the compiler.
(c) exactly one address chosen by the compiler.
(d) exactly one address not known to the compiler.

	Correct answer is 	(d)

	Your score on this question is: 	0.00

	Feedback: 	
   See section 1.4.1 of the course notes.
   (b) 	

	9. 	
	The Visual C++ Memory window displays 	

	(a) the contents of memory, interpreted in one of several ways, without the associated variable names
(b) the names and values of variables in memory, interpreted as 32-bit integers no matter what the variables' types
(c) the names and values of variables in memory, interpreted in one of several ways
(d) the contents of memory, interpreted as 32-bit integers, without the associated variable names

	Correct answer is 	(a)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.3.3 of the course notes.
   (a) 	

	10. 	
	Consider the following segment of C source code.

    int a = 8;
    int b = *&a;

What is the value of variable b at the end of execution of the segment? 	

	(a) (int) &b
(b) (int) &a
(c) &a
(d) a

	Correct answer is 	(d)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.3.2 of the course notes.
   (d) 	

	11. 	
	A jump instruction 	

	(a) increases the program counter
(b) unconditionally sets the program counter to its operand
(c) changes the program counter only if its operand is equal to zero
(d) changes a pointer to point to the next element of an array

	Correct answer is 	(b)

	Your score on this question is: 	0.00

	Feedback: 	
   See section 1.5.2 of the course notes.
   (d) 	

	12. 	
	We want the variable factorialfunc to hold the address of the first instruction of the following function:

    int factorial(int n) {
        if (n == 1) return n;
        return n * factorial(n -1);
    }

How would we declare the variable? 	

	(a) factorial() * factorialfunc;
(b) int (int) * factorialfunc
(c) we can't: C cannot extract the addresses of instructions.
(d) int (*factorialfunc)(int);

	Correct answer is 	(d)

	Your score on this question is: 	0.00

	Feedback: 	
   See section 1.5.2 of the course notes.
   (b) 	

	13. 	
	Programs compiled for an Intel Pentium processor do not execute properly on a SPARC processor from Sun Microsystems because 	

	(a) the assembly mnemonics for the same "opcode" are different in the two processors
(b) copyrights regarding code cannot be violated
(c) the memory of a SPARC CPU is numbered from top to bottom
(d) the operation codes understood by the two processors are different

	Correct answer is 	(d)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.5.1 of the course notes.
   (d) 	

	14. 	
	The program counter contains 	

	(a) the amount of memory a program is currently using
(b) the number of times a program has been executed
(c) the address of the CPU instruction that is about to be executed
(d) the number of CPU instructions a program has executed so far

	Correct answer is 	(c)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.5.2 of the course notes.
   (c) 	

	1. 	
	Which of the following is able to describe a computation at the highest level of abstraction? 	

	(a) C code
(b) machine code
(c) C++ code
(d) logic Gates

	Correct answer is 	(c)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.1.2 of the course notes.
   (c) 	

	2. 	
	Consider the following fragment of C++ source code.

    String msg; unsigned int x; int y;
    cin >> msg >> x >> y;
    cout << x + y;

Which of the following is (are) true regarding execution of the segment?

   1. The input statement will always take the same amount of time to execute.
   2. The output statement will always be executed immediately after the input statement.
   3. If x and y are both positive, an integer greater than both will be printed.

	

	(a) I and II only
(b) II and III only
(c) II only
(d) none

	Correct answer is 	(d)

	Your score on this question is: 	0.00

	Feedback: 	
   See section 1.1.1 of the course notes.
   (b) 	

	3. 	
	When using a debugger to find the cause of a program's incorrect behavior, 	

	(a) the program is usually executed to the point at which the behavior occurs and then executed backwards to find the cause
(b) the faulty code fragment must first be identified
(c) it is fastest to start by stopping the debugger long before the behavior appears
(d) it is often necessary to start the program multiple times under the debugger

	Correct answer is 	(d)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.2.4 of the course notes.
   (d) 	

	4. 	
	Within Visual C++, which of the following will reveal the value of a variable when the program is stopped at a breakpoint?

   1. Placing the mouse pointer over the variable name in the source file window.
   2. Inserting a printf() in the program.
   3. Typing the variable name on the "Watch" window.

	

	(a) I, II, and III
(b) III only
(c) II and III only
(d) I and III only

	Correct answer is 	(d)

	Your score on this question is: 	7.14

	Feedback: 	
   See section 1.2.3 of the course notes.
   (d) 	

	5. 	
	Consider the following program segment.

    int factorial(int * arg) {
        int n = *arg;
        if (n == 1) return n;
        return n * factorial(n - 1);
    }

When the segment is executed, the variable n is allocated to 	

	(a) many addresses none of which is known to the compiler
(b) just one address, and it was chosen by the compiler
(c) many addresses that were chosen by the compiler
(d) just one address, and it is not known to the compiler

	Correct answer is 	(a)

	Your score on this question is: 	0.00

	Feedback: 	
   See section 1.4.1 of the course notes.
   (d) 	

	6. 	
	At which of the following times is an activation record created?

   1. When a program starts executing.
   2. Every time a function is invoked.
   3. When a variable is declared.

	

	(a) I and II only
(b) III only

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -