Comparative Language

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

True/False: Arrays are limited to having either one or two dimensions. Select one: True False

False

True/False: Java is an example of a functional programming language. Select one: True False

False

True/False: The model of computing introduced by Alonzo Church was known as the Church Thesis. Select one: True False

False

True/False: The r-value refers to the location or reference. Select one: True False

False

True/False: a subprogram is an object within a program that can be invoked from elsewhere within the program. Select one: True False

False

True/False: binding refers only to variables. The association of a function name or the output of an expression is not a binding. Select one: True False

False

True/Flase: For complex computations functions may be specified to return multiple values. Select one: True False

False

True/False: The benet of the C language was that it was high level and ensured that the user had no access to the lower level capabilities of assembly language eliminating the potential for many programming bugs. Select one: True False

False

True/False: The following operation in binary will generate the 2's complement binary equivalent of 128? 01111111 + 00000001 Select one: True False

False

True/False: The loader compiles a program and performs type checking on it. Select one: True False

False

True/False: The management of variables is a constant concern and source of complexity for functionality programming languages.

False

True/False: The type char is always 8 bits in length. Select one: True False

False

True/False: Turing's concept of the turing machine was based upon the concepts and rules of mathematical functions. Select one: True False

False

True/False: Type checking is a part of the compilation process that occurs in step 2 syntax analysis. Select one: True False

False

True/False: Using recursion always makes your code faster. Select one: True False

False

Given the following Prolog program: member(X, [X|Xs]). member(X, [Y|Ys]) :- member(X, Ys). How will Prolog evaluate the following query? ?- member(a, [b,c,a,d]).

True

In Perl, given the following code, the statement if($var) will evaluate to: $var = "False" Select one: a. True b. False

True

Programming languages oer abstraction from the details of the computer hardware. This abstraction resulted in less programming eort but also some loss of 'detail' that could potentially result in less ecient code? Select one: True False

True

Programming languages offer abstraction from the details of the computer hardware. This abstraction resulted in less programming effort but also some loss of 'detail' that could potentially result in less efficient code? Select one: True False

True

True/False The following prolog statement is Unifiable? ?- likes(Person, Food) = likes(sam, Food). Select one: True False

True

True/False: A compiler is a program that translates one language to another. Select one: True False

True

True/False: According to EBNF the | character means 'or'. Select one: True False

True

True/False: Algol has influenced programming language design more than any other single programming language?

True

True/False: Algol has inuenced programming language design more than any other single programming language? Select one: True False

True

True/False: An advantage to using an unsigned integer is that a larger positive number can be stored than can be stored with a signed integer. Select one: True False

True

True/False: An algorithm can often be implemented with either recursion or iteration, however iteration typically takes less memory. Select one: True False

True

True/False: An enumeration data type is an abstraction mechanism that allows labels such on/off or high, medium, and low to be associated with simple data types. Select one: True False

True

True/False: An object can inherit data members and functions from one or more based classes. Select one: True False

True

True/False: Big Endian architectures store the most significant byte first (which is the lowest memory address in the range) in memory. Select one: True False

True

True/False: In 'C', the char is essentially a small integer and supports the ability to readily convert between char and integer. Select one: True False

True

True/False: In Prolog the term Resolution describes the process of evaluating all of the elements of an expression to determine if the entire expression evaluate to true or false. Select one: True False

True

True/False: In a Turing machine the only operations that are possible on the ribbon are the read and write of one bit. Select one: True False

True

True/False: In a dynamic typed language the programmer is not required to declare and initialize variable before its use. Select one: True False

True

True/False: In imperative programming languages assignment is the core operation that is performed. Select one: True False

True

True/False: In imperative programming languages, the assignment statement is the only statement that does anything. Select one: True False

True

True/False: In many programming languages such as Java and 'C' the evaluation of an expression that employs operators such as greater than, less than, and, or and not (employing the proper syntax) returns a type of boolean. Select one: True False

True

True/False: In object oriented programming languages such as Java, polymorphism refers to the ability of a class to have more than one method of the same name where the appropriate method is invoked based upon the number and type of arguments and/or the return type. Select one: True False

True

True/False: Lexical analysis is the step in the compilation process where tokens are extracted from the programming language statements. Select one: True False

True

True/False: Perl is an example of a static typed programming language. Select one: True False

True

True/False: Python is a programming language that has the diverse characteristics of being interpreted, byte-compiled, interactive, and object-oriented. Select one: True False

True

True/False: The Assembler language was an early step towards abstraction that allowed programmers to use symbols for machine instructions and not binary numbers? Select one: True False

True

True/False: The IBM model of virtualization evolved from mainframe technology and was based upon the mapping of instructions from the virtual machine to physical machine. Select one: True False

True

True/False: The Scope of a variable refers to the domain where a specific binding refers to the same location in memory. Select one: True False

True

True/False: The Unix virtual machine model implements virtualization through the use of process shells. Select one: True False

True

True/False: The basic regular expression is pattern matching? Select one: True False

True

True/False: The design of the Java Virtual Machine is primarily intended to enhance the portability of Java applications. Select one: True False

True

True/False: The development of the C language is associated with the development of the Unix operating system? Select one: True False

True

True/False: The following code segment represents a valid declaration of a variable in JavaScript. var KeepVar; Select one: True False

True

True/False: The following expression in Prolog is valid. ?- loves(mary,john) = loves(John,Mary). Select one: True False

True

True/False: The front end of a compiler is language-dependent and the back-end is computer dependent. Select one: True False

True

True/False: The main purpose of an abstract class is to be inherited by other classes. Select one: True False

True

True/False: The object of a derived class can perform all the tasks that an object of base class can perform. Select one: True False

True

True/False: The real disadvantage of call-by-reference is that the mechanism is inherently unsafe. Select one: True False

True

True/False: The string type is essentially implemented as an array of characters. Select one: True False

True

True/False: They key limitation of ASCII was that it could only represent 255 characters ? Select one: True False

True

True/False: Type checking will validate, strongly typed programming languages, that the type of an expression is consistent with the type of a target variable. Select one: True False

True

True/False: in Perl, the pragma 'strict' simulates static typing. Select one: True False

True

True/False: non-imperative languages are referentially transparent which means that a particular state is not required for successful and consistent computation. Select one: True False

True

What command is used to distinguish the imperative programming languages from other programming languages? Select one: a. Assignment command b. Simultaneous command c. Iterative command d. Definitive command

a. Assignment command (check this)

Professors John G. Kemeny and Thomas E. Kurtz of Dartmouth University developed which language? Select one: a. BASIC b. PASCAL c. Ada d. Algol

a. BASIC

Which of the following is NOT an example of a dynamic typed programming language? Select one: a. C++ b. Perl c. PHP d. Python

a. C++

The class that inherits attributes and behaviors from the base class is called the: Select one: a. super class b. derived class c. abstract class d. concrete class

b. derived class

Recursion is important in functional programming. Recursion implements the idea of divide and conquer where a problem is divided into smaller problems until the smallest possible case is found. This smallest case is called the

base case

In the following code segment, the variable A is a: int B=1; int Z; Z = myfunc(B); int myFunc( int A ) { return (A+1); } Select one: a. Formal parameter b. Actual Parameter c. Return Type d. Global variable

a. Formal parameter

Which of the following image file formats was developed using a Little-Endian format? Select one: a. GIF b. IMG c. JPEG d. TIFF

a. GIF

The term compiler was coined in the 1950's by which of the following? Select one: a. Grace Hopper b. Alan Turing c. John von Neumann d. John Backus

a. Grace Hopper

The Python language was developed by _____ in 1991 while he was working for the research institute CWI in the Netherlands. Select one: a. Guido van Rossum b. Linus Torvald c. Dennis Richie d. John Backus

a. Guido van Rossum

In Prolog an expression of the following format is known as a ________. H ←B1, B2,..., Bn Select one: a. Horn Clause b. fact c. functor d. term

a. Horn Clause

The RECORD type is implemented in different ways in programming languages. Which option best describes the record implementation in 'C'. Select one: a. struct b. field c. component d. member

a. struct

What elements will the Perl language @a array consist of? $_ = ' a b c '; my @a = split(); Select one: a. ' ', 'a', ' ', 'b', ' ', 'c', ' ' b. undef, 'a', 'b', 'c', undef c. 'a', 'b', 'c' d. ' ', 'a', 'b', 'c'

c. 'a', 'b', 'c'

Using your knowledge of binding, lifetime, and scope rules, determine what the following code will produce as output ... assume that the code in in the Java language: public class test { public static void main(String[] args) { int x,y; x=1; y=my_int(x); System.out.println(x); } static int my_int(x) { x = 5; return(x+x); } } Select one: a. 5 b. 10 c. 1 d. None of these answers

c. 1

What will the output of the following code be? c=1; switch (c) { case 1: print '1'; case 2: print '2'; break; case 3: print '3'; break; } Select one: a. 1 2 3 b. 1 c. 1 2 d. 2 3

c. 1 2

What will the output be for the following poorly formatted program segment, if the input value for num is 22? int num = call to a method that reads an integer; if(num>0) if(num%5 ==0) System.out.println(num); else System.out.println(num+" is negative"); Select one: a. 22 b. 4 c. 22 is negative d. 2 is negative

c. 22 is negative

When Perl evaluates $expr = 1 + 2 * 3 - 4 the value of $expr will contain: Select one: a. 5 b. -3 c. 3 d. None of these answers

c. 3

Which of the following expressions can be evaluated as syntactically correct by the following grammar? E = N | E "+" E. N = "1" | "2" | "3" | "4" . Select one: a. X = 1 + 2 b. 6 + 3 + 1 c. 4 + 2 + 1 d. = 4 + 2 + 1

c. 4 + 2 + 1

In the following code, what data type is the function returning? quicksort :: (Ord a) => [a] -> [a] quicksort [] = [] quicksort (x:xs) = let smallerSorted = quicksort (filter (<=x) xs) biggerSorted = quicksort (filter (>x) xs) in smallerSorted ++ [x] ++ biggerSorted Select one: a. A list of integers Incorrect b. The empty list c. A list of elements with the generic type a d. An integer value

c. A list of elements with the generic type a

The following fragment intends that a user will enter a list of positive integers at the keyboard and terminate the list with a sentinel: int value = 0; final int SENTINEL = -999; while(value != SENTINEL) { // code to process value value = IO.readInt(); } Select one: a. The sentinel gets processed b. The last nonsentinel value entered in the list fails to get processed. c. A poor choice of SENTINEL value causes the loop to terminate before all values have been processed. d. The code will always process a value that is not on the list e. Entering the SENTINEL value as the first value causes a run-time error.

c. A poor choice of SENTINEL value causes the loop to terminate before all values have been processed. ((NOT SURE))

What will the following regular expresssion match to? ([\w]+[-._+&])*[\w]+@([-\w]+[.])+[a-zA-Z]{2,6} Select one: a. A strong password b. A phone number field c. An email address d. The URL of a web site

c. An email address

Consider the following grammar, which of the following is a non-terminal symbol? statement: whileStatement | ifStatement whileStatement: 'while' '(' expression ifStatement: 'if' '(' expression ')' statement statementSequence: | statement ';' statementSequence expression: Select one: a. ( b. if c. while d. statement

d. statement

Consider the following code segment if (n != 0 && n / n > 1000) statement1; else statement2; if n is of type int and has a value of 0 when the segment is executed, what will happen? Select one: a. Neither statement1 nor statement2 will be executed; control will pass to the first statement following the if statement b. A syntax error will occur c. statement1, but not statement2, will be executed d. statement2, but not statement1 will be executed

d. statement2, but not statement1 will be executed

What type of programming approach represents the combination of imperative programming with subprograms? Select one: a. structured programming b. symbolic programming c. sequential programming d. procedural programming

a. structured programming

The functional programming technique that optimizes away recursive calls such that only a single run-time stack frame is required is called. Select one: a. tail recursion b. head recursion c. lazy evaluation d. normal order execution

a. tail recursion

Select the only best answer. The function of the symbolic assembler is to. Select one: a. translate the symbols for instructions into binary bit sequences b. generate assembly language c. optimize machine language code d. provide high level level language abstraction for programmers

a. translate the symbols for instructions into binary bit sequences

The following segment of code in Perl produces the ouput 2. This indicates that Perl is: print 1+"1" Select one: a. weakly typed b. strongly typed c. dynamically scoped d. compiled

a. weakly typed

The output of the following Haskell code will be which of the following options when fac is called with an argument of 5. fac :: Integer -> Integer fac n | n == 0 = 0 fac n | n > 0 = n+fac(n-1) Select one: a. 5 b. 15 c. 10 d. 14

b. 15

Consider the following code segment: for (int k=0; k<20; k=k+2) { if (k%3 == 1) System.out.print(k+" "); } What is printed when this code is executed? Select one: a. 4 16 b. 4 10 16 c. 0 6 12 18 d. 1 4 7 10 13 16 19 e. 0 2 4 6 8 10 12 14 16 18

b. 4 10 16

In the following code, what are the contents of the argument? boomBangs [7..13] Select one: a. 7 and 13 b. 7,8,9,10,11,12, and 13 c. The numbers between 7 and 13 (8,9,10,11,12) d. None of these responses

b. 7,8,9,10,11,12, and 13

In the following example EBNF grammar, what does the symbol <expr> describe? <expr> := '-'? <digit>+ ('.' <digit>+)? <digit> := '0' | '1' | '2' | '3' | '4' | Select one: a. An Integer b. A real number c. A character d. A string

b. A real number

In the following code segment, the variable B is an: int B=1; int Z; Z = myfunc(B); intmyFunc( int A ) { return (A+1); } Select one: a. Formal Parameter b. Actual Parameter c. Return Type d. Local Variabe

b. Actual Parameter

The most famous descendent of Algo is ____ which was developed in the 1960's by Niklaus Wirth. Answer: FILL IN

Pascal

The _________ statement implements a pre-test loop that is used when the number of iterations is NOT known.

While

Convert -32 into a 2's complement binary number: Select one: a. 11100000 b. 00100000 c. 01000000 d. 11011111

a. 11100000

Which of the following is NOT an elementary data type. Select one: a. integer b. boolean c. character d. string

d. string

Which of the following is NOT an example of a markup language? Select one: a. HTML b. SGML c. XML d. Tex e. Tcl

e. Tcl

True/False: The semantics in which the address of a variable is bound to the name of the formal parameter variable is known as copy-in semantics or call-by-value. Select one: True False

False

True/False: The semantics of a procedure call are as follows: the current sequence of instructions are executed in parallel; the sequence of instructions within the procedure body is executed; upon completing the procedure body, the procedure is garbage collected. Select one: True False

False

True/False: The statement x+=1; below is binding the variable x. int x; x=1; x+=1; Select one: True False

False

True/False: The type 2 hypervisor is designed to run directly on bare metal. Select one: True False

False

In the following segment of Prolog code, 'father' is called the ___________ father(jim, mary).

functor

T/F Functional Programming languages were designed to mimic mathematical functions

true

True / False: The Filter function takes in a 'test' and a list, applies the 'test' to every element in the list and returns a list containing every element in the list that satisfied the test. Select one: True False

true

True/False: In Prolog the term Resolution describes the process of evaluating all of the elements of an expression to determine if the entire expression evaluate to true or false. Select one: True Correct False

true

Assume that the following Prolog program has been consulted. a(B,B). Determine the output of the following query and enter in the answer blank. ?- a(1,X), a(X,Y), (Y,Z), a(Z,100).

FALSE

A variable bound at RUN TIME is a STATIC bound variable.

False

True/False: A variable of type long will require 16 bits of memory. Select one: True False

False

True/False: Actual parameters can only be specified as variables Select one: True False

False

True/False: The following segment of JavaScript code is valid. if (how == "reverse") { parent.page1.location.href="page2.html" } else { parent.page2.location.href="page2.html" } Select one: True False

False

True/False: The high order byte refers to a byte with a value greater than 256. Select one: True False

False

True/False: The java compiler generates machine instructions for the target computing using a compiler program known as the JRE. Select one: True False

False

True/False: In syntactical analysis the top-down parsing approach is referred to LL analysis? Select one: True False

True

True/False: In the von Neumann architecture, the bus describes the connections between the components in the architecture that is used to move data between them. Select one: True False

True

True/False: Most scripting languages are interpreted. Select one: True False

True

Given the following Prolog program: member(X, [X|Xs]). member(X, [Y|Ys]) :- member(X, Ys). How will Prolog evaluate the following query? ?- member(X, [b,c,a,d]).

X= b (cause its the head)

All of the following represent which Prolog data type? elephant b aX 'Hello'

Atom

In the following code segment, the statement if (k < 0) return; is called the what? _________________ void badPrint2( int k ) { if (k < 0) return; System.out.println(k); badPrint2( k+1 ); }

Base Case

True/False: Subprograms that return a value are called procedures. Select one: True False

False

True/False: The EBNF (or Extended BNF) approach to grammar specication was a rewrite of the original BNF developed by John Backus designed to 'normalize' grammar specication? Select one: True False

False

True/False: The advantage of fixed-point numbers is that the accuracy,that is the absolute error, is variable. Select one: True False

False

True/False: The benefit of the C language was that it was high level and ensured that the user had no access to the lower level capabilities of assembly language eliminating the potential for many programming bugs. Select one: True False

False

True/False: The model of computing introduced by Alonzo Church was known as the Church Thesis.

False

True/False: The revolutionary innovation that von Neumann introduced in his computer architecture was the use of registers within the Arithmetic Logic Unit. Select one: True False

False

True/False: The switch/case statement is an example of the sequence structure implemented within a programming language? Select one: True False

False

A software object's behavior is exposed through its _____

Method

True/False: Early binding supports compilation, late binding supports interpreters. Select one: True False

True

True/False: Arrays are flexible data structures as the length of the array can be dynamically changed at any time. Select one: True False

False

True/False: JavaScript was derived from the Java language. Select one: True False

False

True/False: Decimal numbers represented directly by assigning four bits to each decimal is callled binary-coded decimal (BCD). Select one: True False

True

True/False: Garbage collection is the process of 'deconstructing' objects to release the memory back to the system. Select one: True False

True

True/False: The stored-program computer architecture was a significant innovation by storing the program and data in memory. Select one: True False

True

A programming language developed in the 1950's for business data processing. Answer: FILL IN

Cobol

The ability to select the appropriate subprogram at run-time based upon an evaluation of types is known as? (NOTE: there are 4 possible answers and you can specify any of the 4).

Dynamic Polymorphism

In the following BNF example, the symboil <sentence> is considered to be a terminal symbol? <sentence> := <subject> <predicate> <subject> := 'John' | ' Mary' <predicate> := 'eats' | 'talks' Select one: True False

False

In scripting languages, memory management is done by a ______________________ and not by the programmer.

Garbage Collector

True/False: Loop statements are the most difficult statements to program. Select one: True False

True

In Prolog the [ ] represents the

empty list

True/False: The ability of the compiler to select, at compile time, the most appropriate data type or method to use based upon data type is known as dynamic polymorphism? Select one: True False

False

A program that translates or implements a computation specified in an abstract form into the detailed form needed for execution on a computer is called a: Answer: FILL IN

Compiler

True/False: Real time, every time is a way of describing the role of a compiler as opposed to an interpreter. Select one: True False

False

True/False: Statically bound variables can be used as arguments in recursive functions. Select one: True False

False

True/False: The Instantiation of an object uses memory that was pre-allocated for the program. Select one: True False

False

True/False: The Turing-Church Thesis states that any computing problem that cannot be solved with a Turning machine can be solved with Lambda Calculus. Select one: True False

False

True/False: A bus with less bits has an advantage because it operates faster and can move more data. Select one: True False

False

True/False: A computer architecture that stores program instructions on an external device such as a tape or drum and not in memory is consistent with the von Neumann architecture? Select one: True False

False

True/False: A computer architecture that stores program instructions on an external device such as a tape or drum and not in memory is consistent with the von Neumann architecture?

False

True/False: A derived class is limited to the characteristics and behaviors inherited from the base class. Select one: True False

False

True/False: A negative number is represented in 2's complement by a leading 0 bit followed by the binary representation of the value. Select one: True False

False

True/False: A superclass contains all of the attributes and behaviors of its subclasses. Select one: True False

False

True/False: A tuple in functional programing is any pair of items passed into a function. Select one: True False

False

True/False: All imperative programming languages support enumeration data types. Select one: True False

False

True/False: An advantage of the array is that is ensures that all values are always in sorted order. Select one: True False

False

True/False: An advantage to a weak typed programming language is that it eliminates type issues that can cause hard to nd bugs in a program. Select one: True False

False

True/False: An algorithm can often be implemented with either recursion or iteration, however recursion is typically faster. Select one: True False

False

True/False: An array is comprised of a collection of elementary data types which can all be of different types. Select one: True False

False

True/False: Assembler Language was developed before Machine Language. Select one: True False

False

True/False: In Java, the programmer is responsible for initiating the garbage collection process when an object has been de-referenced. Select one: True False

False

True/False: In dynamic polymorphism, the appropriate type / method is selected during the compile process. Select one: True False

False

True/False: In syntactical analysis the bottom-up parsing approach is referred to LL analysis? Select one: True False

False

True/False: Integer numbers include the set of all positive whole numbers and zero. Select one: True False

False

True/False: Java's unique design has achieved 100% portability. Select one: True False

False

True/False: One of the features of imperative programming languages is that the programmer species results and input but lets the compiler determine the computation steps necessary to solve the computing problem. Select one: True False

False

True/False: One of the features of imperative programming languages is that the programmer specifies results and input but lets the compiler determine the computation steps necessary to solve the computing problem. Select one: True False

False

True/False: Perl was originally developed by Linus Trovalds as a scripting language for Windows. Select one: True False

False

True/False: Python is an older language than either Tcl/Tk and Perl. Select one: True False

False

When an object is created from a class, we refer to it as an _____

Instance

Which of the following is NOT an example of an imperative programming language? Select one: a. Cobol b. Java c. Prolog d. Fortran

Prolog

Which of the following cannot be dynamically bound: Select one: a. variable b. function c. expression d. language reserved keyword

d. language reserved keyword

What is the binary equivalent of decimal 25 in 2's complement? Select one: a. 00011001 b. 10011001 c. 11100111 d. None of the above

a. 00011001

What is the binary equivalent of decimal 25 in 2's complement? Select one: a. 00011001 b. 10011001 c. 11100111 d. None of these answers

a. 00011001

Which option is the 2's complement of the following binary number: 00011100 Select one: a. 11100100 b. 01111100 c. 10011100 d. None of these answers

a. 11100100

A variable of type byte will have what number of bits? Select one: a. 8 b. 16 c. 1 d. None of the above

a. 8

Which of the following computer systems used a Little-Endian architecture. Select one: a. DEC Alpha b. Java virtual machine c. Sun SPARC d. MIPS

a. DEC Alpha

Given that n and count are both of type int, which statement is true about the following code segments? I for (count=1; count <= n; count++) System.out.println(count); II count = 1; while (count <= n) { System.out.println(count); count++; } Select one: a. I and II are exactly equivalent for all input values of n. b. I and II are exactly equivalent for all input values n>= 1, but differ when n<= 0. c. I and II are exactly equivalent only when n = 0. d. I and II are exactly equivalent only when n is even. e. I and II are not equivalent for any input values of n.

a. I and II are exactly equivalent for all input values of n.

What type of command repeatedly executes the program body (or a block) to determine when execution should stop? Select one: a. Iterative command b. Simultaneous command c. Definitive command d. Assignment command

a. Iterative command (Check this)

Which of the following programming languages is an example of a programming language with strong type checking. Select one: a. Java b. Perl c. PHP d. Shell script

a. Java

The Fortran language was developed in 1957 by a team led by the following: Select one: a. John Backus b. Peter Naur c. Thomas E. Kurtz d. Grace Hopper

a. John Backus

The Fortran programming language was developed by a team led by _______ who later developed a method of describing programming languages syntax. Select one: a. John Backus b. Peter Naur c. Niklaus Wirth d. Dennis Ritchie

a. John Backus

The Tool Command Language with the widget Toolkit (Tcl/Tk) was developed by ______. Select one: a. John Ousterhout b. Bjarne Stroustrup c. Larry Wall d. Guido van Rossum

a. John Ousterhout

Pascal was developed by which of the following: Select one: a. Niklaus Wirth b. Grace Hopper c. John Backus d. John von Neumann

a. Niklaus Wirth

Which of the following is an example of a dynamic typed programming language? Select one: a. Perl b. C c. Pascal d. Java

a. Perl

What feature of the von Neumann architecture was unique at the time and is an element of virtually every modern computer today? Select one: a. Programs and data are stored in memory to facilitate general purpose computing. b. The use of a bus to move data between the components of the architecture c. The use of registers in the arithmetic logic unit d. The introduction of a control unit

a. Programs and data are stored in memory to facilitate general purpose computing.

The following are expressed in what format: 123. 45x103 1.2345x10-8 0.00012345x107 12345000.0x104 : Select one: a. Scientific Notation b. Exponential Notation c. Floating Point Format d. Binary Coded Decimal Format

a. Scientific Notation

In programming languages, which category must make the appropriate decision at run-time between two or more statements or expressions that occur within a program? Select one: a. Selection b. Iteration c. Recursion d. Sequence

a. Selection (not sure)

The step in the compilation process where EBNF or BNF are used to determine if the structure of programming language statements are valid is called. Select one: a. Syntactical analysis b. Lexical analysis c. Type Checking d. Semantic Analysis

a. Syntactical analysis

The correct looping statement to use when the number of iterations is known is: Select one: a. The for loop b. The while loop c. The do .. while loop d. None of these answers

a. The for loop

The expression {4,8} will match: Select one: a. The numbers 4,5,6,7,8 b. Numbers between 4 and 8 (5,6,7) c. Numbers 4 and 8 d. Doesn't match numbers but positions 4-8 in a string.

a. The numbers 4,5,6,7,8

The lexical analysis phase of the compilation process is also known as: Select one: a. Tokenizing b. Optimization c. Preprocessing d. Assembling

a. Tokenizing

What would the output of the following Prolog query be? ?- f(a,b) = f(Y,X). Select one: a. X=b. Y=a. b. This expression will not compile c. X=a. Y=b. d. X=X. Y=Y.

a. X=b. Y=a.

The following code segment is an example of: void f() { ... f() ... } Select one: a. direct recursive call b. indirect recursive call c. an Iterative program d. an Object instantiation

a. direct recursive call

In Perl, to test if the variable $str contains the word "abc" you would use: Select one: a. if ($str = ~/abc/) b. if ($str == "abc") c. if ($str = "abc") d. if ($str contains "abc")

a. if ($str = ~/abc/)

Specific data elements in an array are accessed using an: Select one: a. index b. hash c. key d. pointer

a. index

The following code is an example of what functional programming language concept: (f(x)+f(x))-f(x) is equivalent to 2(f(x))-f(x) Select one: a. referential transparency b. polymorphism Incorrect c. the multiplicative property d. type mapping

a. referential transparency

The extensions to BNF were designed to provide a shorthand to simplify the grammar. The * symbol was one such extension used in EBNF and indicated: Select one: a. something can be repeated any number of times (or be skipped altogether) b. something can appear one or more times c. something could occur only 1 time d. a range of items such as digits or letters

a. something can be repeated any number of times (or be skipped altogether)

Real world objects contain what two things? Select one: a. state and behavior b. methods and attributes c. variables and behaviors d. instances and allocations

a. state and behavior

The following segment of code in Python will produce an error. This indicates that Python tends to be more: print 1+"1" Select one: a. strongly typed b. weakly typed c. statically scoped d. dynamically compiled

a. strongly typed

When the proper method is selected during run-time and executed, this represents an example of: Select one: a. Static Polymorphism b. Dynamic Polymorphism c. early binding d. static dispatching

b. Dynamic Polymorphism

In a functional programming language such as Haskell or Standard ML select the most accurate statement from the following list of statements Select one: a. Functions can process only 1 piece of information. b. Functions can take only 1 argument which can be a primative data type or a compound data type. c. A function must take in (argument) and return the same data type. d. Functions can take in any number of arguments but return only 1.

b. Functions can take only 1 argument which can be a primative data type or a compound data type.

Which of the following is NOT a feature or characteristic of imperative programming languages. Select one: a. Not Referentially Transparent b. Programming species the result not the steps c. Based upon assignment d. Is dependent on state

b. Programming species the result not the steps

What relationship does the following Prolog program represent. r(X, Y) :- parent(Z,X). parent(Z,Y). male(X). X \= Y. Select one: a. X is the father of Y b. X is the brother of Y c. Y is the sister of X. d. X and Y are NOT related.

b. X is the brother of Y

Which of the following is NOT a valid variable in Prolog. Select one: a. Paul b. a_123 c. _123 d. Hello

b. a_123 (lower case)

The following code segment is an example of: void f() { ... g() ... } void g() { ... f() ... } Select one: a. a direct recursive call b. an indirect recursive call c. a nested function call d. functional programming

b. an indirect recursive call

The abstraction of data and the implementation of behaviors in object oriented programming is known as: Select one: a. Polymorphism b. Information Encapsulation c. Information Hiding d. Implementation Abstraction

c. Information Hiding

Which of the following best describes a Type 1 hypervisor. Select one: a. It runs as a process within the the operating system. b. It generates an idealized computer that programs are developed for c. It runs on bare metal d. It generates the shells within the Unix operating system

c. It runs on bare metal

What can we say about the following Haskell function definition: reverse :: [a] -> [a] reverse x | x==0 = 0 | x>0 = reverse[x-1] Please select the best answer. Select one: a. It will recursively count down the value of a to 0. b. The function will take in a argument of type a and return an argument of type a c. It will not compile because the compiler will not allow a generic type (a) when integer operations are being used. d. The routine can pattern match both integers and floating point numbers.

c. It will not compile because the compiler will not allow a generic type (a) when integer operations are being used

What is used to execute Java bytecode? Select one: a. Java Virtual Machine b. Java Virtual Processor c. Java Interpreter d. Java interceptor

c. Java Interpreter (check this)

Which of the following is NOT an example of an imperative programming language? Select one: a. Cobol b. Java c. Prolog d. Fortran

c. Prolog

Select the best response that describes how Prolog will evaluate the following Prolog expression. 3 = 2+1. Select one: a. Prolog will evaluate to true, but will not report the result. b. Prolog will not evaluate to true because there is no variable. c. Prolog will evaluate to false because the = sign is a test of Unifiability not mathematical equality d. Prolog will evaluate to false because mathematical evaluations must be performed within a function

c. Prolog will evaluate to false because the = sign is a test of Unifiability not mathematical equality

In programming languages, which category uses repetition to solve a problem? Select one: a. Selection b. Iteration c. Recursion d. Concurrency

c. Recursion (not sure!!)

Assuming the source text below, what will the following regular expression (in red) match to? ..stage Source Text: All the world's a stage, And all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts... Select one: a. stage b. _stage c. a stage d. No matches

c. a stage

The Cobol language was developed primarily for which of the following: Select one: a. Scientic Programming b. Education and Training in Computer Science c. business data processing d. reporting applications

c. business data processing

The unit of encapsulation and abstraction in object oriented programming that defines data types and subprogram declarations is called a? Select one: a. object b. application programming interface c. class d. interface

c. class

Which of the following is NOT a programming structure? Select one: a. sequence b. selection c. object oriented programming d. repetition

c. object oriented programming

Assuming the source text below, what will the following regular expression (in red) match to? [ ]\w{7,7}[.] Source Text: All the world's a stage, And all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts... Select one: a. world's b. world's players. c. players. d. entranc

c. players.

What values are stored in x and y after execution of the following program segment? int x=-30, y=40; if (x >=0) { if (x<=100) { y=x*3; if (y<50) x/= 10; } else y = x * 2; } else y = -x; Select one: a. x=30 y=60 b. x=30 y=90 c. x=-30 y=30 d. x=3 y=-3 e. x=30 y=40

c. x=-30 y=30 (check this)

What output will the following segment of Perl code produce? my @a = (0, 1, 2); my $b = @a; print $b; Select one: a. 0 b. 1 c. 2 d. 3 e. 0 1 2

d. 3

Which of the following is an example of a imperative programming language. Select one: a. Standard ML b. Haskell c. Prolog d. Algol

d. Algol

Which of the following is NOT a function supported by debuggers? Select one: a. Tracing b. Breakpoints c. Examine/modify data d. Assemble code

d. Assemble code

A programming language is said to support object oriented programming if it includes all of the following constructs EXCEPT: Select one: a. Encapsulation and data abstraction b. Inheritance c. Dynamic polymorphism d. Data Abstraction

d. Data Abstraction

In Perl, a scalar variable can hold: Select one: a. 256 characters b. 1024 characters c. 32768 characters d. Depends on system specifications

d. Depends on system specifications

Dynamic binding occurs _______: Select the one best answer. Select one: a. During translation b. During type checking c. Only during loading d. During execution

d. During execution

Which of the following is NOT one of the steps or 'phases' of the compilation process. Select one: a. Code Generation b. Syntax Analysis c. Lexical Analysis d. Error Checking

d. Error Checking

Which of the following is NOT a component of a subprogram? Select one: a. A declaration which defines the interface to the subprogram b. Local declarations which are accessible only within the body of the subprogram c. A sequence of executable statements d. Global varaiables that can be used within the subprogram

d. Global varaiables that can be used within the subprogram

Which of the following is NOT a component of the von Neuman architecture? Select one: a. Central Arithmetic or Arithmetic Logic Unit b. Memory c. Control Unit d. Graphics Adapter

d. Graphics Adapter

Which of the following is NOT an example of a scripting language? Select one: a. Perl b. Python c. Rexx d. Haskell

d. Haskell

Which of the following is NOT a valid prolog atom? Select one: a. f b. 'Hello' c. <---+---> d. Hello

d. Hello (capital)

The C language was developed at Bell Laboratories by Dennis Ritchie during: Select one: a. The late 1950's b. The early 1960's c. At the same time as Pascal d. In the early 1970's along with Unix

d. In the early 1970's along with Unix

Which of the following is a characteristic of a non-imperative programming language. Select one: a. Based upon assignment and state b. Programmer determines the steps of computing c. Suers from side eects d. Is Referentially Transparent

d. Is Referentially Transparent

Is the following Haskell code valid? Select the most accurate response. circumference :: [a] -> [a] circumference r = 2 * pi * r Select one: a. Yes this code will compile and execute correctly b. No. The function cannot process a list c. No. A generic data type cannot be used because of the mathematical evaluation within the function d. No. Neither the use of a list or a generic data type is valid. An explicit declaration of the appropriate data type is required.

d. No. Neither the use of a list or a generic data type is valid. An explicit declaration of the appropriate data type is required.

Which of the following is NOT an example of an imperative programming language? Select one: a. Java b. Python c. COBOL d. Prolog

d. Prolog

Which of the following is NOT an advantage of Generics? Select one: a. Reusability b. Writeability c. Maintainability d. Reliability

d. Reliability

Which of the following is NOT cloned when a recursive call is made? Select one: a. Code b. Local variables c. Parameters d. Static variables in the program

d. Static variables in the program

Which of the following is NOT an example of a system programming language? Select one: a. Algol b. PL/1 c. Pascal d. Tcl

d. Tcl

Which of the following regex expressions would match the following: MyDogIs12 Select one: a. {a-z}{A-Z}{0-9} b. [a-zA-Z] c. [a-z0-9] d. [a-zA-Z0-9]

d. [a-zA-Z0-9]

Which of the following is NOT a component required to express a floating point number in binary using scientific notation. Select one: a. Mantissa b. Sign c. Exponent d. fixed-point

d. fixed-point

The output of compilation is code generation which typically translates a language construct into assembly language and from there into machine executable code. What language construct was the following segment of assembler code generated from? compute R1,expression jump.eq R1,L1 statement-1 jump L2 L1: statement-2 L2: Select one: a. while statement b. for loop statement c. case statement d. if statement

d. if statement

Consider the following grammar, which of the following is a terminal symbol? statement: whileStatement | ifStatement statementSequence '}' whileStatement: 'while' '(' expression ') ifStatement: 'if' '(' expression ')' statement statementSequence: | statement ';' statementSequence expression: Select one: a. statement b. whileStatement c. ifStatement d. while

d. while

Which of the following is NOT one of the attributes of a variable. Select one: a. scope b. lifetime c. r-value d. Name e. All of these choices are attributes of a variable

e. All of these choices are attributes of a variable

The symbol [ ] in a functional programming language such as Haskell stands for the

empty list

In Prolog the following statement is called a _________ rainy(asheville).

fact

T/F The advantage of lists in functional programming languages is that they can be used to pass in any number of data items with multiple data types

false

True/False: The ability to 'share' replicated expressions to avoid needless computations is known as eagar evaluation.

false

In functional programming, a higher order function is a function that returns a___________

function


Set pelajaran terkait

R+J Chapter 9+10: Groups and Teams

View Set

Genetics Ch.17, 19, 22 Quiz Questions

View Set

IB Sports, Exercise and Health Science Topic 2 Unit 2: The Cardiovascular System

View Set

Intro to Computer Programming part 3

View Set

Health Assessment Ears, Nose, Mouth and Throat Quiz #7

View Set