Dustin White
Quiz por , criado more than 1 year ago

Software Development Computer Science Quiz sobre Data Structures, criado por Dustin White em 15-12-2021.

10
0
0
Dustin White
Criado por Dustin White mais de 2 anos atrás
Fechar

Data Structures

Questão 1 de 40

1

How do referenced types differ from primitive types?

Selecione uma das seguintes:

  • Primitive types are integers.

  • Referenced types are strings.

  • Primitive types use memory addresses.

  • Referenced types use pointers to addresses.

Explicação

Questão 2 de 40

1

Why do programmers use data structures rather than individual values?

Selecione uma das seguintes:

  • for reduced storage

  • for multiple data types

  • for ease of access

Explicação

Questão 3 de 40

1

Which data type only uses one bit per instance?

Selecione uma das seguintes:

  • Short

  • char

  • double

  • boolean

Explicação

Questão 4 de 40

1

Which data type uses the most storage per value?

Selecione uma das seguintes:

  • short

  • int

  • long

  • float

Explicação

Questão 5 de 40

1

What is the output of the following JavaScript code?
var Salutations = [["Dear", "Hello", "Howdy"], ["Friend", "Judy", "Concerned", "Good Old Pal"]]
console.log(Salutations[1][1])

Selecione uma das seguintes:

  • Dear

  • Judy

  • Friend

  • Hello

Explicação

Questão 6 de 40

1

How many elements are there in a two-dimensional array with length (4,7)?

Selecione uma das seguintes:

  • 21

  • 4

  • 7

  • 28

Explicação

Questão 7 de 40

1

What is the output of the following Swift code?
var noKeys = [5,4,7,8,10,22]
var noChains=noKeys.count
print(noChains)

Selecione uma das seguintes:

  • 4

  • 7

  • 22

  • 6

Explicação

Questão 8 de 40

1

Why is a linear search slow?

Selecione uma das seguintes:

  • It uses conditional statements.

  • It tests every element.

  • It copies the array.

Explicação

Questão 9 de 40

1

Why should you exercise restraint and care in the use of mutable arrays?

Selecione uma das seguintes:

  • The syntax for their use is extremely tedious and sensitive.

  • Their use can slow down performance dramatically.

  • The code may become difficult to translate to other languages.

Explicação

Questão 10 de 40

1

What is the output of the following C# code?
using System;
class Program
{
static void Main() {
int[ ][ ] jagged = new int[3][];
jagged[0]=new int[4];
jagged[1] = new int[2];
jagged[2]=new int[7];
Console.WriteLine(jagged[1][1]);
}}

Selecione uma das seguintes:

  • 3

  • 2

  • 0

  • 7

Explicação

Questão 11 de 40

1

What is the defining characteristic of a jagged, two-dimensional array?

Selecione uma das seguintes:

  • The length in the second dimension is variable.

  • The elements consist of strings.

  • The elements are of different data types.

  • The size of the array is not fixed.

Explicação

Questão 12 de 40

1

What is the time complexity for a linear search if the value is not present?

Selecione uma das seguintes:

  • O(ln(n))

  • O(n)

  • O(1)

  • O(n ln(n))

Explicação

Questão 13 de 40

1

How are data elements referenced in an array?

Selecione uma das seguintes:

  • by value

  • with an index or key

  • with a size or type

  • by name

Explicação

Questão 14 de 40

1

What is returned by MyList.contains("Buy glue") if you are using java.util.LinkedList?

Selecione uma das seguintes:

  • a Boolean

  • a string

  • an integer

Explicação

Questão 15 de 40

1

Where does the following Java code add a new element to a linked list?

Node nodeToAdd = new Node(data);
nodeToAdd.next = this.head;
this.head = nodeToAdd;

Selecione uma das seguintes:

  • at the end of the list

  • at the head of the list

  • in the middle of the list

Explicação

Questão 16 de 40

1

What is the time complexity for insertion into a linked list?

Selecione uma das seguintes:

  • O(ln(n))

  • O(1)

  • O(n)

Explicação

Questão 17 de 40

1

How does Python implement linked lists?

Selecione uma das seguintes:

  • as doubly linked lists

  • as arrays

  • as strings

Explicação

Questão 18 de 40

1

What is required to change a singly linked list to a doubly linked list?

Selecione uma das seguintes:

  • a two-dimensional array

  • pointers to adjacent nodes

  • a second head node and reverse pointers

  • a tail node and pointers to previous nodes

Explicação

Questão 19 de 40

1

You have just added a new element at the end of an existing linked list. What is in the pointer of that new element?

Selecione uma das seguintes:

  • the address of the first element in the list

  • a null value

  • the address of the last element in the list

Explicação

Questão 20 de 40

1

What is contained in a node of a linked list?

Selecione uma das seguintes:

  • a value and an index

  • a string and an integer

  • data and a pointer

  • an array and a size

Explicação

Questão 21 de 40

1

How do queues differ from stacks?

Selecione uma das seguintes:

  • Queues use FIFO and stacks use LIFO.

  • Queues use LIFO and stacks use FIFO.

  • Queues add and remove from the end of the list rather than from the beginning.

  • Stacks add and remove from different ends of the list rather than from the same end.

Explicação

Questão 22 de 40

1

What is wrong with the following Java code?

import java.util.Stack;
public class MyClass {
public static void main(String args[]) {
Stack myStack = new Stack();
myStack.push("test");
myStack.pop();
myStack.pop();

Selecione uma das seguintes:

  • There is a missing ;.

  • It attempts to push to an empty stack.

  • There is an extra {.

  • It attempts to pop from an empty stack.

Explicação

Questão 23 de 40

1

The following Swift code uses the push and pop functions as in the example. What is the value of SecondPop?

var deck:Stack=Stack()
deck.push(item: "Queen: Spades")
deck.push(item "10: Diamonds")
deck.push(item: "4: Hearts")
deck.push(item: "2: Hearts")
var FirstPop = deck.pop()
var SecondPop= deck.pop()

Selecione uma das seguintes:

  • 10: Diamonds

  • Queen: Spades

  • 4: Hearts

  • 2: Hearts

Explicação

Questão 24 de 40

1

In the Swift code func pop()-> String?, what does the question mark mean?

Selecione uma das seguintes:

  • The function may sometimes fail.

  • The length of the string is unknown.

  • The value returned is either a string or nil.

  • The argument of the function is unknown.

Explicação

Questão 25 de 40

1

Which data structure is most useful for reversing an ordered state or list?

Selecione uma das seguintes:

  • a queue

  • a stack

  • a string

  • an array

Explicação

Questão 26 de 40

1

What does LIFO stand for?

Selecione uma das seguintes:

  • least important for order

  • limit in free order

  • least in first on

  • last in first out

Explicação

Questão 27 de 40

1

How are items with the same priority dequeued from priority queues?

Selecione uma das seguintes:

  • by FIFO

  • by LIFO

  • by value

  • by size

Explicação

Questão 28 de 40

1

The following Swift code uses the Queue class as in the example. What does the print() function output?

var yourQueue = Queue()
yourQueue.enqueue(item: "10")
yourQueue.enqueue(item: "5")
yourQueue.enqueue(item: "8")
var OutZero yourQueue.dequeue()
var OutOne = yourQueue.dequeue()
print(yourQueue.peek()!)

Selecione uma das seguintes:

  • 10

  • 8

  • nil

  • 5

Explicação

Questão 29 de 40

1

What does a peek() return from a queue?

Selecione uma das seguintes:

  • the first item

  • an arbitrary item

  • the last item

  • the middle item

Explicação

Questão 30 de 40

1

Which language has the least support for hash functions and tables?

Selecione uma das seguintes:

  • Python

  • Swift

  • Javascript

  • Java

Explicação

Questão 31 de 40

1

Which line in the following Python 3 code produces a Key Error?

Selecione uma das seguintes:

  • CapitalsToStates["Austin"] = "Texas"

  • print(CapitalsToStates["New York"])

  • CapitalsToStates = {}

  • print(CapitalsToStates["Austin"])

Explicação

Questão 32 de 40

1

Why would you use separate chaining?

Selecione uma das seguintes:

  • to increase access speed

  • to resolve a collision

  • to calculate a remainder

  • to generate a small index

Explicação

Questão 33 de 40

1

When do hash tables suffer in performance?

Selecione uma das seguintes:

  • when the keys are excessively long

  • when there are collisions

  • when the table is very large

Explicação

Questão 34 de 40

1

How does hashing differ from encrypting?

Selecione uma das seguintes:

  • Encrypting is reversible, but hashing is not.

  • Encrypting produces plain text, but hashing produces integers.

  • Hashing uses ASCII, and encrypting does not.

  • Hashing produces unique values, but encrypting does not.

Explicação

Questão 35 de 40

1

Which statement is true for associative arrays?

Selecione uma das seguintes:

  • Values must be ordered.

  • Keys must be unique.

  • Values must be unique.

  • Keys must be ordered.

Explicação

Questão 36 de 40

1

Which statement is true for a tree data structure?

Selecione uma das seguintes:

  • A parent can have only two children.

  • Leaves can have many children.

  • The root does not have a parent.

  • A node cannot be both a parent and a child.

Explicação

Questão 37 de 40

1

What does the following Python 3 code output?

pocketContents=set(["keys","coins","knife"])
pocketContents.add("receipt")
pocketContents.add("string")
print(pocketContents)

Selecione uma das seguintes:

  • {'receipt', 'coins', 'keys', 'string'}

  • {'receipt', 'coins', 'keys', 'string', 'knife'}

  • {'string', 'knife'}

  • {'receipt', 'coins', 'keys', 'knife'}

Explicação

Questão 38 de 40

1

Which list constitutes a valid set containing four elements?

Selecione uma das seguintes:

  • {0, 5, 12, 0}

  • {"four", "twelve", 6, "four"}

  • {"dog", "cat", "dog", "car"}

  • {0, "dog", "car", 7}

Explicação

Questão 39 de 40

1

What characterizes a min heap?

Selecione uma das seguintes:

  • The children have values less than those of their parents.

  • The value of the right child is less than that of the left.

  • The root contains the largest value.

  • The root contains the lowest value.

Explicação

Questão 40 de 40

1

Why are binary search trees organized with the left child less than the parent and the right child greater than the parent?

Selecione uma das seguintes:

  • to have more layers or branches

  • to reduce storage requirements

  • to use fewer pointers

  • to make them easy to search

Explicação