Data Structures and Algorithms Quiz

Data Structures and Algorithms Quiz

Assessment

Quiz

English

1st Grade

Hard

Created by

Praveen Yadav

FREE Resource

Student preview

quiz-placeholder

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is true about linear and non-linear data structures in java?

Array and LinkedList are non-linear data structures, while Graph and Tree are linear data structures.

Array and LinkedList are linear data structures, while Graph and Tree are non-linear data structures.

Array and Graph are linear data structures, while LinkedList and Tree are non-linear data structures.

Array and Tree are linear data structures, while LinkedList and Graph are non-linear data structures.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which symbol is used to denote a generic type in Java?

*

&

#

<>

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following generic method in Java: Which of the following statements is true about this method?

This method can only print arrays of Strings.

This method can print arrays of any object type, but not primitive types.

This method can print arrays of any type, including primitive types.

This method will cause a compile-time error.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following Java method: Which of the following calls to this method are valid?

printVarargs("Hello", "World");

printVarargs({"Hello", "World"});

printVarargs(new String[]{"Hello", "World"});

printVarargs(new String[]{"Hello"}, "World");

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements about variable-length arguments (varargs) is true?

A method can have multiple varargs parameters.

Varargs parameters must be the first parameter in a method's parameter list.

Varargs parameters can only accept an array of arguments.

A method can have only one varargs parameter, and it must be the last parameter in the method's parameter list.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following Java code snippet: Which of the following statements is true about the given code?

The code will produce a compilation error because generic classes cannot be instantiated with primitive types.

The code will produce a runtime error when calling getContent on integerBox because of type mismatch.

The code will output 123 and Hello.

The code will produce a compilation error because the same generic class cannot be used with different types.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is true?

A generic class may be established with several type parameters.

Primitive data types can be utilized as parameter types.

It is possible to instantiate an array with an element type that is a type parameter.

All of the above

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?