






































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
CSE 240 TESTS COMPILATION BUNDLE PRACTICE TEST SET 2026 QUESTIONS AND COMPLETE SOLUTIONS EXPERT VERIFIED GRADED A+
Typology: Exams
1 / 46
This page cannot be seen from the preview
Don't miss anything!







































⩥ Autocode and FORTRAN are considered to be the first high-level programming languages. Answer: True ⩥ There was an early focus on efficiency due to early programmable computers being themselves fairly inefficent being limited in power and storage. Answer: True ⩥ With over 500 programming languages in the world, the best way approach to learning languages is to focus on memorizing syntax and structure. Then learn languages with simimlar syntaxes and structures. Answer: False ⩥ What is the major improvement of structured programming languages over the earlier programming languages? Answer: Removing Go to statement from the language.
⩥ What programming language characteristics impact the readability of the programs written in this language? Answer: Data Structures, Syntax Design, Control Structures ⩥ What programming paradigm does Fortran belong to? Answer: Imperative ⩥ In contrast to Web 1.0, what is the key function of Web 2.0? Answer: Web is the computing platform ⩥ Event-driven computing paradigm is to Answer: define a set of events and write an event handler for each event. ⩥ von Neumann Architecture is Answer: A state based programming structure which loads and interprets instructions from memory into action ⩥ Event-driven computing paradigm is to Answer: define a set of events and write an event handler for each event. ⩥ If your program was designed to print "Hello World" ten (10) times, but during execution, it printed eleven (11) times. What type of error is it?
for ( ; ; ) {} ⩥ If a program contains an error that divides a number by zero at the execution time. This error is a Answer: Semantic Error ⩥ Given: Very Simple Programming Language (VSPL) ::= a | b | c | ... | z | 0 | 1 | ... | 9 ::= + | - | * | / | % | < | > | == | >= | <= ::= | ::= | ( ) ( ) ::= = ;
::= | The following is valid: myvar = (x + y) * (a - c); Answer: true ⩥ Given: Very Simple Programming Language (VSPL) ::= a | b | c | ... | z | 0 | 1 | ... | 9 ::= + | - | * | / | % | < | > | == | >= | <= ::= | ::= | ( ) ( ) ::= = ;
Answer: false ⩥ If you like to see accurate debugging information, which of the following program processing would you recommend? Answer: Interpretation ⩥ If your application is composed of multiple modules (programs), which of the following program processing would you recommend? Answer: Compilation ⩥ What is the main reason of applying two-step translation of high level programming language? Answer: One compiler for all machines ⩥ What is "func" in this example? #include #define func(x, y) (x > y)? y : x int main() {
int x = 10; int y = 9; int z = func(x, y); } Answer: A macro ⩥ Assume a function requires 20 lines of machine code and will be called 10 times in the main program. You can choose to implement it using a function definition or a macro definition. Compared with the function definition, macro definition will lead the compiler to generate, for the entire program, ______ Answer: a longer machine code but with shorter execution time. ⩥ Given the following code, what is the expected value for z? #include #define func(x, y) (x > y)? y : x int main() { int x = 10; int y = 9;
⩥ What is NOT the purpose (functionality) of the forward declaration (prototype)? Answer: ⩥ A data type defines the Answer: values and operations allowed ⩥ Assume a varible is declared in a block of code within a pair of curly braces. The scope of the variable Answer: starts from its declaration point and extends to the end of the block. ⩥ Given a C declaration: char a[] = "Hello World"; What can be used as the initial address of array a[]? Select all correct answers. Answer: *a[0] &a[0] (check with professor) ⩥ Given a declaration: char a[] = "Hello World"; What is the size (in bytes) of the array a[]? Answer: 12 bytes ⩥ Which of the following C assignment statements (assign a value to a variable at the semantic level) will NOT cause a compilation error?
Assume the array has been declared as: char a[5]; Answer: a[0] = 'h'; ⩥ Which of the following statements will assign the address of the variable int myInt to the pointer int* myPtr? Answer: int* myPtr = &myInt; ⩥ Given the following: int num1 = 5; //addressed at 1877112 int num2 = 15; //addressed at 1877300 int num3 = 20; //addressed at 1877192 double d1 = 1.05; //addressed at 1374376 double d2 = 2.25; //addressed at 1374360 double d3 = 3.14; //addressed at 1374344 After these statements: int* ptr1 = &num ptr1 = ptr1 + 5;
iPtr = num3 (times) 8; 'chPtr' = 'iPtr;' What will the following statement output? cout << ch3; Answer: 'x' ⩥ (True or False) Multiple pointers can reference the same objects. Answer: True ⩥ C/C++ has 2 pointer operators, which operator represents the name of the address? (Commonly refer as l-value.) Answer: Asterisk (*) ⩥ Given this snippet of code, what is the value of x after executing the last statement? int x = 10, *y;
y = &x; y = y + 1; *y = 100; Answer: 10 ⩥ Given this snippet of code, what is the value of x after executing the last statement? int x = 10, *y; y = &x; *y = 100; Answer: 100 ⩥ Given this snippet of code, what is the value of z after executing the last statement? int x = 10, *y, **z;
printf("%d\n", b); // 2nd printf statement a = 20; b = 80; printf("%d\n", **r); // 3rd printf statement } Answer the following three questions. 1.The output of the 1st printf statement is [first].
⩥ We use "Pass by Value" when: Answer: Function does not want to modify the parameter and the value is easy to copy ⩥ We use "Pass by Constant Pointer" when: Answer: Function does not want to modify the value, the value is expensive to copy and NULL is valid ⩥ Given the following code char a[2][4] = { { 'c', 'a', 'r', 'b' }, { 'i', 'k', 'e', '\0' } }; char p = &a[0][0]; while (p != '\0') { printf("%c", *p); p++; } What will happen? Answer: It prints: carbike ⩥ Given the following code char a[2][3] = { { 'c', 'a', 't'}, { 'd', 'o', 'g'} }; int i, j; for (i = 0; i<2 ; i++) { for (j = 0; j<3; j++)
Answer: x = 6, y = 7 ⩥ Consider the following snippet of code in a 32-bit computer. struct contact { char name[30]; int phone; char email[30]; } x; What is the size of variable x in bytes? Answer: 68 ⩥ When is padding required for a structure type variable? Answer: When the structure contains a word-type variable, such as integer, float, and pointer, and the total number of bytes is not a multiple of four. ⩥ The size (number of bytes) of a structure-type variable can be changed by the following factors. Select all that apply. Answer: changing the computer from a 32-bit to a 64-bit processor. changing the orders of the members in the structure.
adding a member into the structure. ⩥ What parameters are required when performing file operations fread and fwrite? Answer: Destination Item Size Number of Items Source ⩥ When will the buffer be created? Answer: When the file operation fopen is performed. ⩥ The reason that we need to call fflush() or cin.ignore() is because the previous Answer: input leaves a character in the file buffer. ⩥ Assume that the search function of a linked list is specified by struct Terminal* search(); What values can the search function return? Select all correct answers.