Question: Question 1 (5 points) In the representation of floating point data types, which part of the representation controls the precision? Question 1 options: The exponent
Question 1 (5 points)
In the representation of floating point data types, which part of the representation controls the precision?
Question 1 options:
| The exponent | |
| Both the mantissa and exponent | |
| The sign bit | |
| The mantissa X |
Question 2 (5 points)
Which of the following is not a scalar data type?
Question 2 options:
| Boolean types | |
| Record types X | |
| Integer types | |
| Enumerated types |
Question 3 (5 points)
In which of the following languages, can subscripting not be used to select a single character with in a string?
Question 3 options:
| C | |
| Ada | |
| Java X | |
| C++ |
Question 4 (5 points)
Which of the following types is intended to be used for nonnumeric data?
Question 4 options:
| Decimal types | |
| Floating point types | |
| Integer types | |
| Enumerated types X |
Question 5 (5 points)
When a two-dimensional array is stored in row major order, which of the following values is needed to compute the location of an array element?
Question 5 options:
| Half the total number of elements in the array | |
| The total number of elements in the array | |
| The number of rows | |
| The number of columns X |
Question 6 (5 points)
What is the difference between a discriminated and free union?
Question 6 options:
| A discriminated union has a tag or discriminant field X | |
| Free unions require greater run time error checking | |
| The size of free unions cannot be computed at compile time | |
| There is no difference |
Question 7 (5 points)
Which of the following languages has both pointers and references?
Question 7 options:
| C++ X | |
| C | |
| Ada | |
| Java |
Question 8 (5 points)
Consider the following code fragment in C++: int *p = new int; p = new int; What happens as a result of the above code?
Question 8 options:
| A dangling reference is created | |
| A dangling pointer is created | |
| The above code will not compile | |
| Garbage is created X |
Question 9 (5 points)
When the reserved word static modifies a C++ local variable, what effect does it have?
Question 9 options:
| It changes the variable's scope | |
| It changes the variable's lifetime X | |
| It changes both the scope and lifetime | |
| static cannot modify local variables in C++ |
Question 10 (5 points)
Variables that are bound to a memory location throughout the life of a program are which of the following kind of variables?
Question 10 options:
| Static global variables | |
| Variables allocated on the heap pointed to by explicit pointer | |
| When any data member is a variable allocated on the heap pointed to by an explicit pointer | |
| Local variables allocated on the stack |
Question 11 (5 points)
For a language to be able to allow recursion, what type of memory allocation must the language support?
Question 11 options:
| Static allocation | |
| Stack allocation | |
| Heap allocation | |
| Free store allocation |
Question 12 (5 points)
In Java, under what conditions can two local variables in the same method have the same name?
Question 12 options:
| Provided their scopes are disjoint X | |
| There are no restrictions | |
| Two different local variables can never have the same name | |
| Provided they have different scopes |
Question 13 (5 points)
Which of the following languages is the most strongly typed?
Question 13 options:
| C++ | |
| Ada X | |
| C | |
| Java X |
Question 14 (5 points)
The struct data type of C can best be described as which of the following kinds of types?
Question 14 options:
| A pointer type | |
| A reference type | |
| An array type | |
| A record type X |
Question 15 (5 points)
When does static binding of a variable name to a memory location occur?
Question 15 options:
| At compile time X | |
| Not until run time | |
| It depends on the program | |
| Not until link time |
Question 16 (5 points)
When a language provides automatic garbage collected, which of the following tasks is the programmer freed from having to do explicitly?
Question 16 options:
| Allocate heap-dynamic variables | |
| Deallocate stack-dynamic variables | |
| Deallocate heap-dynamic variables X | |
| Allocate stack-dynamic variables |
Question 17 (5 points)
In Java, which of the following produces a compilation error?
Question 17 options:
| Assigning a short to a int | |
| Assigning an int to a double | |
| Assigning an int to a long | |
| Assigning a double to a float X |
Question 18 (5 points)
Consider the following code fragment in C++: int *p; *p = 5; What happens as a result of the above code?
Question 18 options:
| The above code will not compile | |
| Automatic garbage collection occurs | |
| Garbage is created that can never be deallocated | |
| A dangling pointer is being deferenced, which could cause the program to crash X |
Question 19 (5 points)
What term is used to describe the language feature in which the type of a variable is determined by a default convention, such as a naming convention?
Question 19 options:
| Default binding | |
| Explicit declaration | |
| Name binding | |
| Implicit declaration X |
Which of the following best describes the difference between a pointer and a reference?
Question 20 options:
| Pointers can point to memory on the heap, references cannot | |
| Pointers are implicitly dereferenced | |
| References can point to memory on the heap, pointers cannot | |
| References are implicitly dereferenced X |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
