0% found this document useful (0 votes)
71 views

Quiz 1

Uploaded by

FRANCISCO TUN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Quiz 1

Uploaded by

FRANCISCO TUN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Dashboard / My courses /
CMPS2131-LFL / 31 August - 6 September /
Quiz 1: Units 1 & 2

Started on Thursday, 2 September 2021, 11:06 AM


State Finished
Completed on Thursday, 2 September 2021, 12:04 PM
Time taken 58 mins 16 secs
Grade 27.00 out of 30.00 (90%)

Question 1

Correct

Mark 1.00 out of 1.00

Lists of data can be stored in arrays, but linked lists provide several advantages except. 
 

a.  Linked lists are dynamic, so the length of a list can increase or decrease as necessary.

b. Linked lists have faster insertion and deletion time complexities.

c. Linked lists allow random access and use less memory per element. 

Question 2

Correct

Mark 1.00 out of 1.00

In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?

a. Pointer to integer

b. Node

c.  Pointer to character

d. Pointer to node 

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 1/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Question 3

Correct

Mark 1.00 out of 1.00

A Constructor  is a special 'MEMBER FUNCTION' having the same name as that of its class which is used to initialize

some valid values to the data members of an object. ... The constructor can be defined as a class in the same way as that of
normal member functions and can access any of its data members.

Question 4

Incorrect

Mark 0.00 out of 1.00

A node  contains a pointer member that points to an object of the same class type.

Question 5

Correct

Mark 1.00 out of 1.00

 By default node class members are private. 

Select one:
True 

False

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 2/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Question 6

Complete

Mark 5.00 out of 5.00

For the snippet of code below, create a display function. The function will traverse the nodes and display the assigned values as
outputs to the user. 
int main()
{

   Node* head= newNode();


   Node* second= newNode();
   Node* third= newNode();

   Node* fourth= newNode();


 
   head->Value=1;

   second->Value=2;

   third->Value=3;
   fourth->Value=4;  
   system("pause>0");
}

#include<stdlib.h>

#include<iostream>

usingnamespacestd;

struct node{

int data;

struct node*next;

};

void display(node*n){a

while(n!=NULL){//whilenisnotequaltonull

cout<<n->data<<"";//print n

n=n->next;

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 3/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Question 7

Complete

Mark 3.00 out of 3.00

What does the snippet of code below do?

struct Node

int data;

struct Node* next;

};

This is a self-referential class. Contains a pointer member that points to an object of the same class type. 
struct Node //name of class is node

int data; //data

struct Node* next; //pointer data member next is a link. can tie a node to another node

};

Question 8
Correct

Mark 1.00 out of 1.00

What are the two main categories of data structures?

a. dynamic and linked lists.

b. retrieval, processing,storage and orgaization of data.

c. array of contiguous memory locations and linked structures. 

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 4/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Question 9

Correct

Mark 1.00 out of 1.00

A(n) _____________is an operation that creates a new instance (object) of an abstract data type. 

a. A destructor

b. An iterator

c. A constructor 

Question 10

Correct

Mark 1.00 out of 1.00

A node can not contain data of any type, including objects of other classes.

Select one:
True

False 

Question 11

Correct

Mark 1.00 out of 1.00

A Data structure  is a collection of data elements whose organization is characterized by accessing operations that are

used to store and retrieve the individual data elements; the implementation of the composite data members in an abstract data

type

Question 12

Correct

Mark 1.00 out of 1.00

A linear collection of self-referential class objects, called nodes, connected by pointer links.

a. linked list 

b. node

c. data structure

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 5/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Question 13

Correct

Mark 1.00 out of 1.00

A __________ is a data-type that has its own members. It is the basic building block of OOP in C++. It's members are accessed in
programming languages by creating instances and may be user defined.

a. sequential data structure

b. stack

c. class 

Question 14

Correct

Mark 2.00 out of 2.00

The linked list node is decomposed into two basic parts: the data  and address to the next node(pointer). 

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 6/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Question 15

Incorrect

Mark 0.00 out of 2.00

 What is the functionality of the following code?

public void function(Node node)

if(size ==0)

head = node;
else

Node temp,cur;

for(cur = head;(temp = cur.getNext())!=null; cur = temp);

cur.setNext(node);

}
size++;

a.  Inserting a node at the end of the list

b. Deleting a node at the end of the list

c. Inserting a node at the beginning of the list 

d. Deleting a node at the beginning of the list

Question 16

Correct

Mark 1.00 out of 1.00

By convention, the link pointer in the last node of a list is set to null (0) to mark the end of the list.

Select one:
True 

False

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 7/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Question 17

Complete

Mark 2.00 out of 2.00

List 2 types of linked lists.

Circular Linked Lists.

Doubly Linked Lists. 

Question 18
Complete

Mark 3.00 out of 3.00

List three actions which may be performed on a linked list.

Search to determine if a particular item is on the list.

Insert item in the list.


Delete items from the list.

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 8/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Question 19

Correct

Mark 1.00 out of 1.00

Which of the following is not a disadvantage to the usage of array?

a. Insertion based on position

b. Accessing elements at specified positions 

c. Fixed size

◄ LAB ASSIGNMENT: EDITING SINGLY LINKED LISTS.

Jump to...

VIRTUAL CLASSROOM: MRS. LA-DENE FORRESTER LAMBEY ►

The Information Technology Program prepares students for work, further study and research in the Information Technology field locally,
regionally and globally. The program provides knowledge, skills and the discipline that will enable graduates to make a positive impact
on the working environment and be able to function as entrepreneurs in the community.

Quick Links

About UB

About FST

Faculty and Staff

UB Virtual Tour

UB Student Portal

UB ACM Student Chapter

Follow Us


Contact
Hummingbird Avenue, City of Belmopan

 Phone: (501) 822-1000/ 822-3680

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 9/10
9/10/21, 3:27 PM Quiz 1: Units 1 & 2: Attempt review

Copyright © 2020 - Developed by UB MPIT-IT. Powered by Moodle

Data retention summary


Department of Mathematics, Physics, and Information Technology (MPIT) - Faculty of Science and Technology - University of Belize

https://doit.ub.edu.bz/mod/quiz/review.php?attempt=29371&cmid=9104 10/10

You might also like