Solved Exam 1 - Structure Program in C | CSCE 206, Exams of Computer Science

Form B Material Type: Exam; Professor: Hurley; Class: STRUCTURED PROG IN C; Subject: Computer Sci. & Engr.; University: Texas A&M University; Term: Fall 2011;

Typology: Exams

2010/2011

Uploaded on 11/07/2011

koofers-user-jza
koofers-user-jza ๐Ÿ‡บ๐Ÿ‡ธ

7 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSCE 206 (501-512) Structured programming in C
2011 Fall - Exam 1
Question set B
Name: ___________________________ UIN: ___________________________
TA: ________________________ CLASS: ______________________________
True/False questions:
1. Is this True or False : !0&&0||0. F
2. X || Y && Z is the same as (X || Y) && Z. F
3. Is this True or False : !!5. T
4. A break statement will exit all loops: the inner and the outer loops. T/F
5. We use the symbol โ€œ//โ€ for multiline comment. F
6. Comments cannot be placed in the middle of a keyword or identifier. T
7. Lexical analysis decides how tokens are related. F
8. Parentheses are used to increase the precedence of the operations inside them. T
9. Semicolons โ€œ;โ€ need to be placed after every line in a C program. T/F
10. A variable can be declared after they are assigned value. F
11. Identifiers in C are case insensitive. F
12. Each preprocessing directive MUST be on its own line. T
13. A C program can have multiple main functions where execution begins and ends. F
14. Interpreters translate and execute each program statement dynamically. T
15. FORTRAN, COBOL, and LISP are all high level programming languages. T
16. Data, in computers, is stored in binary form, as a series of 0s, 1s, and 2s. F
17. Program Counter is a special memory location which contains the instruction currently being
processed. F
18. When a program Fetch command is executed, it retrieves a copy of the program command
from the address stored in the program counter, and then it proceeds to update the program
counter to the address of the next instruction. T
19. ENIAC was the first general purpose, electronic, digital computer. T
20. Assemblers convert program instructions from assembly language into machine language. T
21. C language is an assembly language. F
22. In the process of performing a Modular Design for a given program, an example of one
would start with the smallest parts and then proceed to larger parts. This type of process is
known as Top โ€“ down Modular design. F
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

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

CSCE 206 (501-512) Structured programming in C

2011 Fall - Exam 1

Question set B

Name: ___________________________ UIN: ___________________________

TA: ________________________ CLASS: ______________________________

True/False questions:

  1. Is this True or False : !0&&0||0. F
  2. X || Y && Z is the same as (X || Y) && Z. F
  3. Is this True or False : !!5. T
  4. A break statement will exit all loops: the inner and the outer loops. T/F
  5. We use the symbol โ€œ//โ€ for multiline comment. F
  6. Comments cannot be placed in the middle of a keyword or identifier. T
  7. Lexical analysis decides how tokens are related. F
  8. Parentheses are used to increase the precedence of the operations inside them. T
  9. Semicolons โ€œ;โ€ need to be placed after every line in a C program. T/F
  10. A variable can be declared after they are assigned value. F
  11. Identifiers in C are case insensitive. F
  12. Each preprocessing directive MUST be on its own line. T
  13. A C program can have multiple main functions where execution begins and ends. F
  14. Interpreters translate and execute each program statement dynamically. T
  15. FORTRAN, COBOL, and LISP are all high level programming languages. T
  16. Data, in computers, is stored in binary form, as a series of 0s, 1s, and 2s. F
  17. Program Counter is a special memory location which contains the instruction currently being processed. F
  18. When a program Fetch command is executed, it retrieves a copy of the program command from the address stored in the program counter, and then it proceeds to update the program counter to the address of the next instruction. T
  19. ENIAC was the first general purpose, electronic, digital computer. T
  20. Assemblers convert program instructions from assembly language into machine language. T
  21. C language is an assembly language. F
  22. In the process of performing a Modular Design for a given program, an example of one would start with the smallest parts and then proceed to larger parts. This type of process is known as Top โ€“ down Modular design. F
  1. The figure above shows a flowchart representation of an algorithm. F
  2. The following two expressions are identical. T Variable %= Exp; Variable = Variable % Exp;
  3. Defining the character โ€˜Cโ€™ and the single-character string โ€œCโ€ will produce the same result. F

Multiple choice questions:

  1. Variable declaration enables the compiler to: D A. set aside the appropriate amount of memory to hold the variable B. determine what operations are permissible with that variable C. determine What sort of data is allowed to be stored in that variable D. All of the above E. None of the above
  2. What is the correct output for the following code segment? D int i = 0, b = 1, c = 2; c -= b += c += -5; printf(โ€œ%d\nโ€, b); A. 0 B. 3 C. 7 D. - E. -
  3. Which of the following is NOT variable declaration D A. int a; B. float c; C. char d; D. #define PI 3. E. int PI =3.14;
  4. Which of the following is correct variable initialization? E

D. scanf(โ€œ%d %dโ€, &a &b); E. 3 + a = number;

  1. What will be the console output of the following statements? B int j=2, k=3, m=4; printf("%d\n", j*=k=m+5 ); A. 17 B. 18 C. 19 D. 20 E. none of above
  2. Pick error row in the true table for the logical operators D p q p||q A. 0 0 0 B. 0 1 1 C. 1 1 1 D. 1 0 0 E. none of above
  3. What is the j value of the following expression? C-E int i, j =2; j = !j || (i=i+1); A. - B. 0 C. 1 D. 10 E. none of above
  4. What is the proper format for a preprocessor directive? D A. include{stdio.h} B. int main(void) C. void foobar(int f) D. #include<stdio.h> E. include(stdio.h)
  5. A line of code that describes a functions name, return type, and parameters is called a C A. declaration B. preprocessor directive

C. function prototype D. variable declaration E. function directive

  1. Which of the following is not a C binary arithmetic Operator? C A. * B. -= C. ++ D. / E. %
  2. The following are all relational operators except: B/D A. > B. -= C. == D. ?= E. !=
  3. What is the output of the following code? D int x = 11, y = 3; printf("%d, %d", x % y, x/y); A. 1, B. 2, C. 1,2. D. 2, E. none of the above
  4. Find the correct output for the following code segment D int a, b, c = 0; a = c++; b = ++c; printf("%d %d %d", a, b, c); A. 0 1 2 B. 1 2 3 C. 1 2 2 D. 0 2 2 E. 1 1 2
  5. Which of the following line is correct? A A. printf(โ€œI like %c %sโ€, โ€˜cโ€™, โ€œvery much!โ€);

int final = (a%60)*c; A. 12 B. 20 C. 0 D. 2 E. none of the above

  1. What will be the console output of the following statements? A int b=2, d=4; printf("%d\n", 7- -b*++d); A. 17 B. 18 C. 19 D. 20 E. none of above
  2. One kilobyte is: A A. 2 10 bytes B. 10 2 bytes C. 1000 bits D. One tenth of a terabyte E. None of the above
  3. Memory is divided into: B A. Programs B. Cells C. Buffers D. ROM E. None of the above
  4. What is/are the standard coding system[s]? D A. ASCII B. QWERTY C. EBCDIC D. a and c E. None of the above
  5. What is the role of a CPU? C A. To store dynamic, volatile data B. To store nonvolatile data, possibly read-only data

C. Performing calculations and controlling hardware D. To allow the user to write and edit text E. None of the above

  1. What is the role of ALU? D A. To read the individual program B. To execute the instruction C. To retrieve a copy of the program command D. To perform arithmetic computations and logical operations E. None of the above
  2. What is 01001000 (BINARY) in decimal format? C A. 01001000 B. 100 C. 72 D. 27 E. None of the above
  3. All of the following are mass storage devices except: C A. Floppy drives B. CD-ROMs C. ROMs D. Zip disks E. None of the above
  4. We need a programming language in order to: D A. Tell the computer precisely what to do B. Have a universal language understood by all people. C. Avoid the ambiguity in natural language D. A&C E. None of the above
  5. Scanf must have _____ for its arguments. E A. doubles B. characters C. functions D. integers E. addresses
  6. A program that controls the processing of the machine is a: B A. Translator
  1. What value is assigned by the following statement: A a="a+b;" A. A string consisting of the characters 'a' '+' 'b' ';' '\0' B. A character containing the result of the addition C. The single character 'a' D. The integer result of the addition E. The floating point result of the addition
  2. All of the following are punctuation characters except: E A. commas , B. semicolons ; C. brackets { } D. parenthesis ( ) E. quotation marks "
  3. A compiler outputs: A A. machine code B. executable code C. byte code D. pseudocode E. source code
  4. What will be the console output of the below statement? C printf(โ€œhello, \n programming \t worldโ€);

A. hello, programming world B. hello, programming C. hello, programming world D. hello programming world E. none of above

  1. Which of the following is NOT a logical operator? B A. && B. // C.! D. ||

E. none of the above

  1. These compiled files contain pre-written functions that can be used by programmers: B/C A. objects B. libraries C. header files D. executables E. data files
  2. The following are relational operators except: D A. > B. < C. >= D. = E. !=
  3. The following are arithmetic operators except: E A. % B. - C. / D. * E. =
  4. Which of the following is the correct order of the Software Life Cycle?: B A. Design, Testing, Implementation, Analysis, Maintenance B. Analysis, Design, Implementation, Testing, Maintenance C. Analysis, Design, Testing, Maintenance, Implementation D. Design, Analysis, Implementation, Maintenance, Testing E. Analysis, Testing, Design, Implementation, Maintenance
  5. Which of the following is an example of an Object Oriented Programming Language?: C A. Fortran B. Cobol C. Java D. C E. Prolog