Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 (5 points) In the representation of floating point data types, which

ID: 3848736 • Letter: Q

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

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

The exponent

Both the mantissa and exponent

The sign bit

The mantissa X

Explanation / Answer

Q1. The mantissa
A signed digit string in floting point is reffered as mantissa.the length of the mantissa determines the precision to which numbers can be represented.
  
Q2. Record type
A scalar data type means which data type hold a single data item.Records Types holds multiple data items then they are not a scalar data type.

Q3. Java
String class of a java does not have these subscripting on string feature.

Q4. Enumerated types
Enumerated data type consisting of a set of named values called elements,members,non-numerics of a data.so it intends to be as non-numeric data type.

Q5. The number of rows
In row-major order the elements of an array reside in row-by-row then elements of first row stored first.Then location of an element calculated by the number of rows


Q6. A discriminated union has a tag or discriminant field
In free union there is no varient to hold the the value,those varients are tags which are present in discriminated union and there are some immutable fields in discriminated union.

Q7 . C++
C++ supports both Pointers and references,In C++ a reference is similar to pointer.Some times a reference can be used as an alternative to pointer, in particular, for the function paramete

Q8. Garbage is created
int *p = new int;
p = new int;
Here P creates a refernce object it cannot access on execution only garbage is collected.

Q9 . It changes the variable's lifetime

Q10 . Static global variables
Once we declare a variable as a static the value remains same through out the program

Q11. Stack allocation

Q12. Provided their scopes are disjoint

Q13. JAVA , ADA
JAVA,ADA,C support the use of explicit casts of arithmetic values to other arithmetic types.In this C supports more kinds of implicit conversion and allows pointers.then JAVA and ADA are strongly typed.

Q14. A record type

Q15. At compile time

Q16. Deallocate heap-dynamic variables

Q17. Assigning a double to a float

Q18. A dangling pointer is being deferenced, which could cause the program to crash

Q19. Implicit declaration

Q20. References are implicitly dereferenced

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote