Singly and Doubly Linked List Quiz

Singly and Doubly Linked List Quiz

University

17 Qs

quiz-placeholder

Similar activities

Cardiac / Neurological Emergencies

Cardiac / Neurological Emergencies

University - Professional Development

20 Qs

Heart part 2 (EKG)

Heart part 2 (EKG)

University

15 Qs

Lecture SIX.

Lecture SIX.

University

20 Qs

Stats Review

Stats Review

University

20 Qs

Pengujian Hipotesis 1

Pengujian Hipotesis 1

University

20 Qs

Zahlen

Zahlen

KG - University

21 Qs

Data Structures Prelimes

Data Structures Prelimes

University

16 Qs

BCA C Lab Component

BCA C Lab Component

University

15 Qs

Singly and Doubly Linked List Quiz

Singly and Doubly Linked List Quiz

Assessment

Quiz

Other

University

Hard

Created by

Niveditha N

Used 1+ times

FREE Resource

17 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which line correctly defines a Node in a singly linked list?

class Node {

int data;

Node next;

Node(int d) {

_______________; // ← Fill this}}

this.next = d;

data = d; next = null;

this.data = next;

data = next;

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What should go in the blank?

void insertAtHead(int data) {

Node newNode = new Node(data);

newNode.next = ___________; // ← Fill this

head = newNode;}

null

head

newNode

head.next

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Choose the correct loop:

Node temp = head;

while (__________) {

System.out.print(temp.data + " ");

temp = temp.next;}

temp != null

head != null

temp.next != null

temp.data != 0

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which line correctly moves to the second-last node?Node temp = head;

while (temp.next.__________) {

temp = temp.next;}

next != null

next == null

next.next != null

data != null

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

(Double)Which is correct?class DNode {

int data;

DNode next, prev;

DNode(int d) {

data = d;

next = null;

_________; // ← Fill }}

prev = d;

prev = null;

d = prev;

prev = next;

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which line completes the logic?(Double)

DNode newNode = new DNode(data);

newNode.next = head;

if (head != null)

head.__________ = newNode;

head = newNode;

next

prev

data

pointer

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Complete the code to print the list in reverse:(double)

DNode temp = tail;

while (temp != null) {

System.out.print(temp.data + " ");

temp = ___________;

}

temp.next

temp.prev

head.prev

temp.back

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?