Search Header Logo
DCS2101 - Week 12 (Practical Applications 2)

DCS2101 - Week 12 (Practical Applications 2)

Assessment

Presentation

Computers

University

Practice Problem

Medium

Created by

Yasmin Basiran

Used 2+ times

FREE Resource

30 Slides • 14 Questions

1

media

2

media

3

Word Cloud

What do you understand about pointers?

4

media

5

media

6

media

7

media

8

media

9

media

10

media

11

media

12

media

13

media

14

media

15

media

16

media

17

media

18

media

19

media

20

Multiple Choice

What does a pointer variable store?

1
The value of a variable.
2
The type of a variable.
3
The size of a variable.
4
The memory address of another variable.

21

Multiple Choice

Which symbol is used to access the value stored at the address pointed by a pointer?

1
&
2
*
3
@
4
%

22

Multiple Choice

What is the output of the following code?

int x = 10;

int *p = &x;

cout << *p;

1
15
2
20
3
10
4
5

23

Multiple Choice

What will happen if you dereference a null pointer?

1
Dereferencing a null pointer always results in a warning message.
2
Dereferencing a null pointer results in undefined behavior, often causing a crash.
3
Dereferencing a null pointer returns a valid memory address.
4
Dereferencing a null pointer leads to a successful operation.

24

Multiple Choice

What is the main purpose of using pointers in tree data structures?

1

Store data values in arrays.

2

Sorting elements in a list.

3

For memory allocation in stacks.

4

To connect nodes for efficient traversal and manipulation.

25

Word Cloud

How many nodes does a binary tree usually have?

26

media

27

media

28

media

29

media

30

media

31

media

32

media

33

34

media

35

media

36

media

37

Multiple Choice

Which traversal visits nodes in the order: Left → Root → Right?

1
Preorder traversal
2
Postorder traversal
3
Level-order traversal
4
Inorder traversal

38

Multiple Choice

Which traversal uses a queue instead of recursion or a stack?

1
Level order traversal
2
Pre-order traversal
3
Post-order traversal
4
In-order traversal

39

Multiple Choice

In a tree, the nodes without any child are called:

1
branch nodes
2
root nodes
3
internal nodes
4
leaf nodes

40

Multiple Choice

What does the pointer root typically point to in a binary tree?

1
A random node in the binary tree.
2
The topmost node of the binary tree.
3
The leftmost leaf of the tree.
4
The last node added to the tree.

41

Multiple Choice

In C++, when creating a new node dynamically, what statement is used?

1

Node node;

2

Node *node = &Node;

3

Node *node = new Node;

4

Node = new Node;

42

Multiple Choice

What happens if you forget to delete a dynamically allocated node?

1
A memory leak occurs.
2
The memory is reused by the system.
3
The program crashes immediately.
4
The node is automatically deleted.

43

Draw

Draw the binary tree represented by the following traversal output:

Preorder: A, B, D, E, C, F

44

media
media

Show answer

Auto Play

Slide 1 / 44

SLIDE