







































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 MIDTERM COMPREHENSIVE DATA STRUCTURES AND ALGORITHMS STUDY GUIDE 2026
Typology: Exams
1 / 47
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-then-else 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 ::= + | - | * | / | % | < | > | == | >= | <= ::= | ::= | ( ) ( )
a = b + c + d; 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()
โ In C++, what function can be used to input a string with spaces? Answer: cin.getline(...); โ 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:
char* chPtr = &ch3; int* iPtr = &num3; 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
q = &b; *q = 70; r = &p; **r = 90; printf("%d\n", a); // 1st printf statement 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].
3.The output of the 3rd printf statement is Correct 20. โ We use "Pass by Constant Reference" when: Answer: Function does not want to modify the value, the value is expensive to copy and NULL is not valid โ 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
y++; printf("x = %d, y = %d", x, y);
โ 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.