系統(tǒng)級編程選擇題解析_第1頁
系統(tǒng)級編程選擇題解析_第2頁
系統(tǒng)級編程選擇題解析_第3頁
系統(tǒng)級編程選擇題解析_第4頁
系統(tǒng)級編程選擇題解析_第5頁
已閱讀5頁,還剩64頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Multiple Choice Quiz 1QuestionlCompared to a sequence of machine code instructions, a fragment of C code選擇一個答案a. does not engage any transistors during itsexecutionb. may describe the same algorithm/may describe the same algorithmc. describes the actions of the computer, notjust of the CPUd. is the

2、native way to program most computersMlQuestion2Which of the following is able to describe a computation at the highest level of abstraction? 選擇一個答案a. C+ codeb. logic Gatesc. C coded. machine codeQuestion3Which of the following does a debugger do?1. Analyze the source code to find programming errors.

3、2. Decode machine code generated by a compiler.3. Stop execution of a program.選擇一個答案a. III onlyb. I and III onlyc. II and III onlyd. I, II, and III.Question4Integrated programming environments make it difficult to mix and match tools from differentsources. This is選擇一個答案a. good, because it ensures co

4、mpilation is notdone incrementally by accidentb. bad, because all the tools will then havethe same user interface 3c. good, because tools from different sources cannot be made to interact with each othertod. bad, because no single vendor is likelybe the source of all the best toolsQuestion5Consider

5、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 immedia

6、tely after the input statement.3. If x and y are both positive, an integer greater than both will be printed.選擇一個答案a. II and III onlyXIb. I and II onlyc. II only Jfd. none /Question6Which of t he following Visual C+ objects are contained within a Project? I.Files II.Visual C+ Solutions III.Flow char

7、ts選擇一個答案a. I, II and IIIb. I only /c. II onlyd. II and III onlyQuestion7When using a debugger to find the cause of a programs incorrect behavior, 選擇一個答案a. it is fastest to start by stopping thedebugger long before the behavior appearsb. it is often necessary to start the programmultiple times under

8、the debuggerc. the faulty code fragment must first beidentifiedd. the program is usually executed to the point at which the behavior occurs and then executed backwards to find the causeQuestion8In Visual C+, a Win32 Console Application is 選擇一個答案C+a. the simplest type of application Visual can genera

9、te b. the status window of the Visual C+ environmentc. a program that is able to control the operating system of a windows computerd. built by using sophisticated Application Wizards ITMultiple Choice Quiz 2QuestionlWhich of the following could be represented by one bit of information? 選擇一個答案a. an A

10、SCII characterb. the color of a single pixel on a true-color computer displayc. the position of a light switch婚d. the current channel of a televisionreceiverQuestion2In C, what is the following binary number in hexadecimal?11010101選擇一個答案a. 0xAB Fb. 0x5D c. 0xB5 ld. 0xD5 詒Question3What is the value o

11、f the following C expression?0x1234人0x5432選擇一個答案a. 0x1030b. 0x5434c. 0x4606 Vd. 0x5636Question4What is the value of the following C expression?0x1234 & 0x5432選擇一個答案a. 0x1030 fb. 0x1111c. 0x5636d. 0x6666Question5How is 46 (decimal) represented in an 8-bit 2s complement binary format? 選擇一個答案a. 0100011

12、0b. 00101100c. 00011110d. 00101110/Question6How is -10 (decimal) represented in an 8-bit 2s complement binary format? 選擇一個答案a. 11111010b. 10001010c. 11110101d. 11110110/Question7In a computer with 4-byte words, which of the followingC expressions tests whether ptr containsthe address of a word?I. (p

13、tr & 3) = 0II. (ptr | 3) = 0III. (ptr % 4) = 0選擇一個答案a. II onlyb. III onlyc. I onlyd. I and III onlyQuestion8What happens in a C program when an addition would cause integer overflow?選擇一個答案a. An incorrect result is produced andexecution continues. /b. The correct value is coerced to a floatingpoint n

14、umber.c. An exception-handler is called with the twooperands as parameters.d. Execution is terminated.Question9What is the purpose of the exponent in floating point numbers?選擇一個答案a. to indicate where the decimal or binarypoint should be /b. the mantissa is raised to the power of the exponent xc. to

15、specify the superscript| 僉 |d. to specify the base as binary, octal, or hexadecimal xQuestion10Which of the following statements about floating-point numbers in C is true?I. Floating-point numbers are often only approximations of real numbers.II. A 32-bit float only approximates decimal fractions, b

16、ut a 64-bit double represents them exactly.III. Floating-point numbers can represent any rational real number but not irrationals. 選擇一個答案a. II only 區(qū)b. I and III onlyc. I only 諂d. I and II onlyQuestion11Which of the following numerical operations is most likely to lead to loss of precision? 選擇一個答案a.

17、 Floating-point addition/b. Integer multiplicationEc. Floating-point multiplicationd. Integer additionQuestion12In C, using default floating point settings, what happens when a floating-point computation results in an overflow?選擇一個答案a. A special value infinity is computed,testable withinite()./b. An

18、 exception is raised unless disabled bycalling _controlfp().c. An erroneous value is computed and execution continues.d. Program execution is halted.Multiple Choice Quiz 3QuestionlThe program counter contains選擇一個答案a. the number of times a program has beenexecuted | 上 Ib. the number of CPU instructio

19、ns a programhas executed so farc. the address of the CPUinstruction that isabout to be fetched /d. the amount of memory a program is currently using TQuestion2Immediately after the CPU executes an instruction that is neither a branch nor a jump instruction, the program counter選擇一個答案a. is incremented

20、 by oneb. is incremented to point to the following instruction /c. has a value that cannot be determinedwithout further information|J_|d. remains unchanged | J |Question3A CPU register is a word of CPU memory that 選擇一個答案a. is explicitly loaded and unloaded fromnormal memory by compiler-generated ins

21、tructions Zb. houses a critical variable for the durationof the execution of a programI 暑 Ic. is automatically loaded when a CPUinstruction refers to a word of normal memory(Ed. records the results of periodic CPU diagnostics IQuestion4Which of the following computations may be performed by exactly

22、one CPU instruction?a. increases the program counter1. a = 5;2. a = b + c * 5;3. for (i = 0; i 10; i += ai+);選擇一個答案a. II onlyb. I, II, and IIIc. I onlyd. I and II onlyQuestion5Suppose that, using a tool such as the memory window of Visual C+, we found that a certainset of contiguous memory locations

23、 contained the integer 0xC605CD623A8365000000. What could these memory locations hold?1. the integer 0xC605CD623A83650000002. a string3. a CPU instruction選擇一個答案a. I and II only L*Jb. I onlyc. III onlyd. I, II, and IIIQuestion6A branch instruction選擇一個答案a. sets the program counter to one of two possib

24、le values /b. increases the program counter by a fixed amountc. unconditionally sets the program counterto its operandd. sets the program counter to one of many possible valuesQuestion7A jump instruction選擇一個答案b. changes a pointer to point to the nextelement of an arrayc. changes the program counter

25、only if itsoperand is equal to zerod. unconditionally sets the program counterto its operand |/Question8The machine code generated from source code by a compiler 選擇一個答案a. does not preserve all the information given in the source code /b. can be easily inspected to check the correctness of the compil

26、erc. executes more quickly than the source codeEd. associates variable values with theirnames FlQuestion9Which of the following are true of the effect that optimizations have on the machine code generated by compilers?I. The resulting code will be faster and/or smaller.II. The resulting code will be

27、 clearer.III. The resulting code will be harder to debug.選擇一個答案a. I and III only 更b. I and II onlyc. I, II, and IIId. I onlyQuestion10amountsWhich of the following is a good reason (are good reasons) to equip the CPUwith small of fast memory?I. To make the design of the compiler simplerII. To make s

28、ome CPU instructions smallerIII. To make some CPU instructions faster選擇一個答案a. II only gb. I, II, and IIIc. II and III only/d. III onlyQuestionll.Which of the following must be true if a program is stopped at a specific line within theVisual C+ debugger?I. There is at least one breakpoint enabled.II.

29、 There is a breakpoint enabled on that line.III. There is a breakpoint enabled on the line preceding that line. 選擇一個答案a. none /b. I onlyc. I and III onlyd. I and II onlyQuestion12when the programWithin Visual C+, which of the following will reveal the value of a variable is stopped at a breakpoint?I

30、.Placing the mouse pointer over the variable name in the source file window.ILIn serting a printf() in the program.III. Typing the variable name on the Watch window.選擇一個答案a. II and III onlyb. I, II, and IIIc. I and III only 電d. III onlyQuestion13a SPARCprocessorPrograms compiled for an Intel Pentium

31、 processor do not execute properly on from Sun Microsystems because選擇一個答案a. the memoryof a SPARCCPU is numbered fromtop to bottomb. the assembly mnemonics for the sameopcode are different in the two processorsc. copyrights regarding code cannot be violated xd. the operation codes understood by the t

32、wo processors are different 才Multiple Choice Quiz 4QuestionlThe Visual C+ Memory window displays 選擇一個答案a. the contents of memory, interpreted as32-bit integers, without the associatedvariable namesb. the names and values of variables in memory, interpreted in one of several waysc. the names and valu

33、es of variables inmemory, interpreted as 32-bit integers no matter what the variables typesd. the contents of memory, interpreted in one of several ways, without the associatedvariable names |Question2Consider the following code a;int b;int main(int argc, char *argv) int c;int d;/* some

34、 code */Which of the following must be true?選擇一個答案a. The values of &a and &b are closer to each other than the values of &c and &d.b. The values of *a and *b are closer to each other than the values of *c and *d.c. The value of &d is closer to the value of&c than to the value of &a.Zd. The value of

35、*d is closer to the value of*c than to the value of *a.Question3Consider the following code. char a100;a99 = *(char *) (int) & a0) + 4)If integers are 32 bits wide, which of the following values is equal to a99?選擇一個答案a. a40b. a0 + 4 Ic. the integer stored in the bytes a4,a5,a 6 and a7d. a3因Question4

36、Which of the following statements about alignment within C structs is true?1. Alignment may cause the allocation of unused space.2. Alignment is required by all modern processors.3. Alignment can help processors access data more efficiently.選擇一個答案a. I onlyb. I and III only/c. I, II, and IIId. II and

37、 III onlyQuestion5分數:1/1In C, assuming that an int takes 4 bytes, how many bytes are required to represent the following array?int a12;選擇一個答案a. 44 |l |b. 121c. 52 Id. 48 VQuestion6分數:1/1Given the following declaration and initialization of s, what is the value of the expressions6?char s = string;選擇一

38、個答案a. an unpredictable valuefflb. nc. g引d. 0/Question7In C, assuming that an int takes 4 bytes, if array a is declared as follows and a has the value 0x10000, what is the value of the expression a + 2?int a12;選擇一個答案a. 0x10008/b. 8 plus the contents of location 0x10000c. 0x10004d. 0x10002Question8Giv

39、en the address of a C struct at runtime, how is the address of a memberelement in the struct determined?選擇一個答案a. The element name is looked up in a symboltable.b. A constant offset associated with themember is added to the address.c. A linear search is made from the baseaddress of the struct.d. The

40、struct consists of an array of pointersto the elements of the struct.Question9In one computer, the bytes with addresses A, A+1, A+2 and A+3 contain the integer 256, and the variable declared with int * a; has the value A. In a different computer, the bytes with addresses B, B+1, B+2 and B+3 also con

41、tain the integer 256, and the variable declared with int * b has the valueB. Which of the following are necessarily true?The contents of A+1 are equal to the contents of B+1.The contents of A+1 are equal to the contents of B+2.*a = *b選擇一個答案to hold the address of the firstinstruction of the following

42、a. Ill onlyb. I only 7c. II and Ill onlyd. I and III onlyQuestionlOWewant the variable factorialfuncfunction:int factorial(int n) if (n = 1) return n;return n * factorial(n -1);How would we declare the variable?選擇一個答案a. int (*factorialfunc)(int);b. int (int) * factorialfuncc. factorial() * factorial

43、func;d. we cant: C cannot extract the addressesof instructions.Multiple Choice Quiz 5QuestionlConsider the program given below.#includeint 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);retur

44、n 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 informationgiven.c. Two different integers are printed, and the value of neither can be determined

45、 from the information given. /d. 5 is printed twice on the same line.Question2What does the following program print? int callee(int * count) count+;return *count;int main (int argc, char *argv) int count = 4;int retval;retval = callee(&count);printf(%d, retval);return 0;選擇一個答案a. 4 .illb. 5c. 8d. can

46、not be determined from the informationgiven. /Question3What is printed as a result of execution of the following program?#include void callee(int * count) (*count)+;int main (int argc, char *argv) int count = 4;callee(&count);printf(%d, count);return 0;選擇一個答案a. 8b. 5/c. It cannot be determined from

47、theinformation given. Hd. 411Question4What does the following program print?void callee(int * count) (*count)+;int main (int argc, char *argv) int count = 4;callee(count);printf(%d, count);return 0;選擇一個答案a. 4b. 8 Jt-Ic. 5川d. nothing: it will not compile successfully /Question5Consider the following

48、 factorial(int n) if (n = 1) return n;return n * factorial - 1);How many activation records are popped when it is invoked by the expression factorial(4)?選擇一個答案a. 4 /b. 5c. 1d. 0 HQuestion6Activation records are organized in stacks because選擇一個答案a. they are seldom needed during programexec

49、ution.b. stacks allow activation records to bepushed and popped in any order.c. functions need to access all the variablesof the functions that call them.d. stacks are simple enough for the hardwareto manage. 0Question7When executing a function callee(), which of the following are true regarding the

50、 value ofthe frame pointer?I. It marks the top of the stack frame of the function that invoked callee().II. lt marks the bottom of the stack frame of callee()Hl.lt is the top of the stack.選擇一個答案a. II onlyb. I and II onlyc. I onlyd. III onlyQuestion8In one computer, the bytes with addresses A, A+1, A

51、+2 and A+3 contain the integer 256, and the variable declared with int * a; has the value A. In a different computer, the bytes with addresses B, B+1, B+2 and B+3 also contain the integer 256, and the variable declared with int * b has the value B.In a computer in which both addresses and integers a

52、re 32 bits wide, how many bytes of memory will the compiler allocate for following code fragment?int a;int * b = &a;選擇一個答案a. 8 /b. 4c. 32d. 0Question9Consider the following program factorial(int * arg) int n = *arg;if (n = 1) return n;return n * factorial(n - 1);When the segment is execu

53、ted, the variable n is allocated to選擇一個答案a. just one address, and it was chosen by thecompiler Ub. many addresses that were chosen by thecompilerc. just one address, and it is not known tothe compilerd. many addresses none of which is known tothe compiler ZQuestion10At which of the following times i

54、s an activation record created?I. When a program starts executing.II. Every time a function is invoked.III. When a variable is declared.選擇一個答案a. II onlyb. I and II onlyc. III onlyd. II and III onlyIEQuestionConsider the following i;intj = 1;int callee(int number) int plusone;plusone = nu

55、mber + 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. plusone only.b. i only.c. i, j and number only.d. plusone and number only. Question12Consider the following i;int * jp = &i;void main(int i, char * arg

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論