Docsity

Structured Programming in C - Solved Exam 1 | CSCE 206, Exams of Computer Science

Toggle sidebar
bg1
– Form A –
True/False Questions:
1. A modem allows computers to transmit data over telephone lines. T
2. Compilers translate and execute each program statement dynamically. F
3. A Program Counter is a type of special – purpose memory cell which contains the instruction
currently being processed. F
4. Linker creates object program and stores it on disk. F
5. The following two expressions are equivalent. T
A /= B; A = A / B;
6. When designing a program, one could start with smallest parts and then proceed to larger parts.
This type of process is known as Bottom – up Modular design. T
7. Reserved keywords can also be used as variable name only if it is not used elsewhere in program.
F
8. The following line will not make any problem in compiling. T
x = y /*divide y by z*/ / z ;
9. Each preprocessing directive MUST be on its own line, although # is used as the beginning of a
preprocessing directive. T
10. Global variables are stored in HEAP. F
11. Is this TRUE or FALSE: !!10 T
12. A4C in hex is 101000011100 in binary. F
13. Both break and continue statement exit inner loop immediately and statement right after loop is
executed. F
14. The code below will print “Howdy!” for 10 times. F
for(i=0; i<=10; i++)
printf("Howdy!\n");
15. A for loop like the following: F
int x;
for(x = 1 ; x < 3; x++){
…
}
works the same as:
int x=1;
while(x++){
…
x<3;
}
Multiple Choice Questions:
16. What does GUI stand for? B
A. Grand Unsigned Integer
B. Graphic User Interface
C. Graphic Utility Invoker
D. Great Ultimate Integer
pf3
pf4
pf5
pf8

Partial preview of the text

Download Structured Programming in C - Solved Exam 1 | CSCE 206 and more Exams Computer Science in PDF only on Docsity!

– Form A –

True/False Questions:

  1. A modem allows computers to transmit data over telephone lines. T
  2. Compilers translate and execute each program statement dynamically. F
  3. A Program Counter is a type of special – purpose memory cell which contains the instruction currently being processed. F
  4. Linker creates object program and stores it on disk. F
  5. The following two expressions are equivalent. T A /= B; A = A / B;
  6. When designing a program, one could start with smallest parts and then proceed to larger parts. This type of process is known as Bottom – up Modular design. T
  7. Reserved keywords can also be used as variable name only if it is not used elsewhere in program. F
  8. The following line will not make any problem in compiling. T x = y /divide y by z/ / z ;
  9. Each preprocessing directive MUST be on its own line, although # is used as the beginning of a preprocessing directive. T
  10. Global variables are stored in HEAP. F
  11. Is this TRUE or FALSE: !!10 T
  12. A4C in hex is 101000011100 in binary. F
  13. Both break and continue statement exit inner loop immediately and statement right after loop is executed. F
  14. The code below will print “Howdy!” for 10 times. F for(i=0; i<=10; i++) printf("Howdy!\n");
  15. A for loop like the following: F int x; for(x = 1 ; x < 3; x++){ … } works the same as: int x=1; while(x++){ … x<3; }

Multiple Choice Questions:

  1. What does GUI stand for? B A. Grand Unsigned Integer B. Graphic User Interface C. Graphic Utility Invoker D. Great Ultimate Integer

E. Graphic User Inaccuracy

  1. What is 01100010 (BINARY) in decimal format? E A. 01001000 B. 100 C. 72 D. 27 E. 98
  2. What is the role of BUS? C

A. To store dynamic, volatile data B. To perform arithmetic computations C. To transfer bits between CPU and Memory D. To distribute computation E. None of the above

  1. What is the role of ALU? B

A. To read the individual program B. To perform arithmetic computations and logical operations C. To execute the instruction D. To retrieve a copy of the program command E. None of the above

  1. Which of the following is a legal assignment statement in C language: A

A. y = x = 3; B. y == x; C. y * 3 = x + 2; D. (- y) = (- x); E. 2y = b;

  1. All of the following are considered tokens except: E

A. Keywords B. Operators C. Constants D. Identifiers E. White Space

  1. Which of the following is an example of a Secondary Storage Medium?: B

A. Read Only Memory

E. Feb

  1. scanf must have _____ for its arguments. C

A. doubles B. characters C. addresses D. integers E. functions

  1. Which of the following is NOT variable declaration A

A. PI = 3.14; B. int a; C. float c; D. char d; E. int PI =3.14;

  1. Which of the following doesn’t have bug? C A. print(“hello, world!”); B. int a; b; // declare both a and b for the first time C. char b[10]; scanf(“%s”, b); D. float a, b; scanf(“%d%d”, &a, &b); E. #define BIG 10000;
  2. Which of the following is correct variable initialization? B

A. int a = 'b'; B. char A = '8'; C. int A[15] = "Mary"; D. float f = f * 2.0; E. string a = "First";

  1. Which of the following line is NOT correct D int main(void) { char str[80]; // Line A printf("Enter a string: "); // Line B scanf("%s", str); // Line C printf("Here's your string: %s", str[0]); // Line D

return 0; // Line E } A. Line A B. Line B C. Line C D. Line D E. Line E

  1. Which of the following line is correct? C

A. printf("I like %c %s", "c", "very much!"); B. printf("I like %s %c", 'c', "very much!"); C. printf("I like %s %s", "c", "very much!"); D. printf("I like %c %c", 'c', "very much!"); E. printf("I like ", "c", "very much!");

  1. What term describes how a compiler decides how tokens are used C

A. compiling B. linking C. parsing D. executing E. reading

  1. A line of code that describes a functions name, return type, and parameters is called a

B A. declaration B. function prototype C. function definition D. variable declaration E. function directive

  1. Which of the following is not a C binary arithmetic Operator? D

A. * B. + C. / D. ++ E. %

  1. Which one of the following is illegal? C

A. +cnt--;

int i, j = 5; j = (i = 10) && j; A. - B. 0 C. 10 D. 1 E. 15

  1. What is the value of j after the following expressions are executed? C int j, i = 2; j = i || (j = 10); A. - B. 0 C. 1 D. 10 E. 2
  2. A program that controls the processing of the machine is a: E A. Translator B. Compiler C. Word Processor D. Machine Processor E. Operating system
  3. Which of the following translate and execute each program statement dynamically? B A. Keywords B. Interpreters C. Loaders D. Translators E. Operating Systems
  4. Techniques of shared processing over networks are generally called: D A. Remote computing B. Sharing C. Parallel programming D. Distributed computing E. None of the above
  5. Which of the following types can be used with a switch? A

A. int B. double C. float D. A and B E. None of the above

  1. for loops contain E

A. a boolean expression and a body B. an initialization statement and body C. an update statement and body D. an initialization statement, boolean expression, and body E. an initialization statement, boolean expression, incrementation statement, and body

  1. What is the output for the following segment of code? C int main() { x = 2; while (x < 4) { printf("%d", x ++); } return 0; } A. 1 2 3 B. 1 2 3 4 C. 2 3 D. 0 1 2 3 E. 0 1 2 3 4
  2. A switch statement REQUIRES which of the following: C

A. a break at the end of the switch statement to exit B. a break after every case C. an expression to test the cases against D. a default statement at the end E. all of the above are required