Download CSE 240 Midterm Exam With 100% Correct Answers 2023 and more Exams Advanced Education in PDF only on Docsity! CSE 240 Midterm Exam With 100% Correct Answers 2023 C++ was designed to bring Object Orientation to C. In fact it was originally released with the unimaginative name "C with Classes" - Correct Answer-true "When piloting a helicopter - changing speed can/will change your direction and possibly vice versa" - Correct Answer-false There was an early focus on efficiency due to early programmable computers being themselves fairly inefficent being limited in power and storage. - Correct Answer-true Autocode and FORTRAN are considered to be the first high-level programming languages. - Correct Answer-true von Neumann Architecture is: - Correct Answer-A state based programming structure which loads and interprets instructions from memory into action Which programming paradigm is focused primarily on the data and how it is modeled and used? - Correct Answer-object oriented When evaluating a programming language the category Reusability describes: - Correct Answer-This concept asks how tied down a language is to a particular platform, can code be distributed easily and can libraries be made and shared Event-driven computing paradigm is to - Correct Answer-define a set of events and write and event handler for each event What computing paradigm can solve a problem by describing the requirements, without writing code in a step-wise fashion to solve the problem. - Correct Answer-logic In contrast to Web 1.0, what is the key function of Web 2.0? - Correct Answer-~ Web supports semantic analysis What programming language characteristics impact the readability of the programs written in this language? - Correct Answer-control structures, syntax design, data structures What is the major improvement of structured programming languages over the earlier programming languages? - Correct Answer-removing goto statement from the language What programming paradigm does Fortran belong to? - Correct Answer-imperative What computing paradigm enforces stateless (no variable allowed) programming? - Correct Answer-functional What is a feature of object-oriented computing? - Correct Answer-encapsulation of states Learning the concepts, logic and problem solving of programming unlocks our ability to learn knew languages. - Correct Answer-true Reliability speaks to how easily a programmer can express themselves reliably within the language. - Correct Answer-false Orthogonality ... - Correct Answer-Sort: One to many Compositional: Many to many Number: A general lack of restriction on reproducing features in your code If I have set of commands S1 that describe data types in my language and a set of commands S2 that describe creation of variables: - Correct Answer-Sort orthogonality For the following BNF ruleset, which are terminal symbols? (Check all that apply.) - Correct Answer-y a Which command will have a loop when expressed in a syntax graph? - Correct Answer- switch Which of the following cannot be checked by an imperative or object-oriented compiler. (Check all that applies.) - Correct Answer-semantics A programming languages can be broken down into four structural layers. Identify these layers. (Check all that applies.) - Correct Answer-semantics contextual syntactic Given: Very Simple Programming Language (VSPL) <char> ::= a | b | c | ... | z | 0 | 1 | ... | 9 <operator> ::= + | - | * | / | % | < | > | == | >= | <= <variable> ::= <char> | <char> <variable> <expr> ::= <variable> <operator> <variable> | ( <expr> ) <operator> ( <expr> ) <assign> ::= <variable> = <expr>; <statements> ::= <assign> | <assign> <statements> The following is valid: (a+b) = (x*y); - Correct Answer-false Given: Select all that apply: What does it mean for a function to be a "first class citizen"? - Correct Answer- Functions can be passed to other functions as parameters Functions can be created and used anywhere and also assigned to an identifier to be reused. Functions can be returned from a function Which of the following constructs break or bend the normal functional programming rules of scheme? - Correct Answer-let begin Which of the following constructs break or bend the normal Syntax patterns of scheme? (<thing I want to do> <things I want to do it too>) (select all that apply) - Correct Answer-let begin cond if True/False - This function is a Right-Fold pattern: (define foo1 (lambda (input) (if (null? input) 0 (if (eq? (modulo (car input) 2) 0) (+ 1 (foo1 (cdr input))) (+ 0 (foo1 (cdr input)))) ))) (foo1 '(1 2 3 4 5 6 7)) - Correct Answer-true True/False: This function is a Right-Fold Pattern: (define foo2 (lambda (input acc) (if (null? input) acc (if (eq? (modulo (car input) 2) 0) (foo2 (cdr input) (+ acc 1)) (foo2 (cdr input) acc))) )) (foo2 '(1 2 3 4 5 6 7) 0) - Correct Answer-false Given the Scheme code as follows. What is the output? (define not-gate (lambda(x) (if (= x 0) 1 0))) (define onescomplement (lambda (a-list) (map not-gate a-list))) (onescomplement '(0 1 0 2 0 3)) - Correct Answer-(1 0 1 0 1 0) Given this procedure, what is the expected result? (map (lambda (x) (+ x x 2)) '(1 2 3 4 5 (6 7))) - Correct Answer-Error Message A higher order function is a function that takes the - Correct Answer-operator of a function as an argument. In the following query language statement, which function acts as the filter function? var myQuery = from b in Books where b.price < 80 orderby b.title select b; - Correct Answer-where Filter is a higher-order function that - Correct Answer-applies a function to all elements of a list. Compare the follow two Scheme forms: (append '(1 2) '(4 5)) and (cons '(1 2) '(4 5)). - Correct Answer-(cons '(1 2) '(4 5)) returns '((1 2) 4 5). The double-dot operator ".." is a relative operator that refers to the parent directory of the current directory. - Correct Answer-true The tilde operator "~/" is a Path operator that refers to the user's Home directory. - Correct Answer-true The single-dot operator "./" is an Absolute Path operator that refers to the user's Home directory. - Correct Answer-false The Absolute Path is the specific folder that the Root User works within. It holds all of the nitty-gritty details of the operating system and shouldn't be change very often, hence: Absolute. - Correct Answer-false The "Root" actually refers to the lowest layer of the File Structure of a Linux/Unix system which is laid out in a tree like structure growing up from the root. - Correct Answer-true Match the command to its operation: - Correct Answer-ls Gives a listing of files and directories in the working directory cd Changes working directory mkdir Creates a new directory mv Move a vile to a specific location. Can also be used to rename a file. cp Copy a file to a specific location chmod Change the permissions of a file pwd Show the current directory rm Delete a file More or less, less is more ... or is it? Maybe you should just feed the cat.... - Correct Answer-more This text output command shows the text a page at a time, but cannot go backwards. Will end on its own when you reach the end of file. less The most robust text command it has options to move backwards and forwards, but must be explicitly exited. cat The simplest tool,it just dumps the text out to standard out whether it can fit or not. No scrolling options. vi/emacs A text editing tool,your mileage may vary. Really only added because I needed a fourth option for blackboard to work. The diff command allows you to compare to files and see how they differ. - Correct Answer-true GREP allows us to find keywords in a file and report where they are located in the file. - Correct Answer-true This operator allows you to redirect the output of a command or application from stdout to another location. - Correct Answer-> This operator allows you to redirect the input of a command or application from stdin to another location (often a file). - Correct Answer-< Given this macro and this code snippet: #define SLOPE(xa, ya, xb, yb) yb-ya / xb - xa int x1 = 1; int y1 = 1; int x2 = 5; int y2 = 7;