Data Structures and Algorithms in Computer Science, Quizzes of Computer Science

A comprehensive overview of various data structures and algorithms used in computer science, including binary, bitwise manipulation, boolean, character, denary, integer, real/floating point, two's complement, unicode, binary search tree, depth first traversal, linked lists, lists, queues, tuples, undirected graphs, boolean expressions, boolean logic, commutation laws, de morgan's laws, distribution laws, binary shifts, masking binary numbers, character sets, arrays, lists, stacks, circular queues, hash tables, and more. It includes explanations, examples, and code snippets for each topic.

Typology: Quizzes

2020/2021

Uploaded on 04/24/2024

geoffrey-kasaba
geoffrey-kasaba 🇰🇪

4 documents

1 / 42

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1.4 Data Ty pes, Data Structures and Algorithms
1
Q
What does AND () mean?
A
A logical operator which returns TRUE (or 1) if and only when all inputs are TRUE (or 1)
2
Q
What is ASCII?
A
A character set used to represent alphanumeric characters or symbols as a set of 8 bits
1 check bit and 7 bits for the number
3
Q
What is binary?
A
A number system that only uses 1s and 0s to represent numbers (a base 2 system)
4
Q
What is bitwise manipulation?
A
Operations perfomed on a set of bits
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a

Partial preview of the text

Download Data Structures and Algorithms in Computer Science and more Quizzes Computer Science in PDF only on Docsity!

1.4 Data Types, Data Structures and Algorithms

Q

What does AND (∧) mean? A A logical operator which returns TRUE (or 1) if and only when all inputs are TRUE (or 1) 2 Q What is ASCII? A A character set used to represent alphanumeric characters or symbols as a set of 8 bits 1 check bit and 7 bits for the number 3 Q What is binary? A A number system that only uses 1s and 0s to represent numbers (a base 2 system) 4 Q What is bitwise manipulation? A Operations perfomed on a set of bits

Q

What is boolean? A A data type that can only store one of two possible values (1 or 0, TRUE or FALSE, etc.) 6 Q What is a character? A A data type for storing one letter, number or special character 7 Q What is Denary? A A number system that only uses 10 characters (0 to 9) to represent numbers (a base 10 system) 8 Q What are the 5 data types? A Character Boolean String Integer

Q

What is the primitive data type? A A basic built in data type provided by a programming language 14 Q What is a Real/Floating point? A A data type for storing numbers with decimal or fractional parts 15 Q What are the binary Shifts? A A bitwise manipulation where a set of bits are all moved by one place in a given direction, and the end bit may be taken as a carry or appended to the other end depending on the shift method 16 Q What is the String data type? A Used to store a sequence of alphanumeric characters or symbols, typically within quotation marks 17 Q

What is Two’s Complement? A A method of storing negative numbers in binary It involves flipping all the bits of the binary representation of the positive number and then adding 1 18 Q What is UNICODE? A A character set that is a superset of ASCII It is used to represent alphanumeric characters and symbols as an integer code point which is equal to that character’s ASCII code 19 Q What does XOR do? A A logical operator which returns TRUE or 1 when only one input is TRUE or 1 20 Q What are arrays? A A data structure for storing a finite, ordered set of data of the same data type within a single identifier

The edges are one way 25 Q What is a graph? A A data structure consisting of a set of vertices/nodes connected by a set of edges/arcs 26 Q What is a Hash Table? A A data structure where a hashing algorithm calculates a value to determine where a data item is to be stored The data item can then be directly accessed by recalculation, without any search Uses an algorithm to determine storage location. 27 Q What are Linked Lists? A A data structure that stores an ordered sequence of data where each item is stored with a pointer to the next item The items are not stored contiguously (in this same order) in memory 28

Q

What are Lists? A A data structure that stores a sequence of data values, each with a unique index 28 Q What are Queues? A A first in first out (FIFO) data structure The first item added/pushed on to the queue is the first to be removed/popped off 28 Q What are Stacks? A A last-in-first-out data structure The last item added/pushed is the first to be removed/popped off 28 Q What are Records? A A data structure that stores a collection of fields which store data based on attributescan be did data type

A

A ∧ (B ∧ C) = (A ∧ B) ∧ C

A V (B V C) = (A V B) V C

Q

What are Boolean expressions? A A combination of Boolean values and logical operators which evaluates to either TRUE or FALSE depending on the inputs 34 Q What is Boolean Logic? A A type of algebra with logical operators where all the values and expressions ultimately reduce to TRUE or FALSE 35 Q What are the Commutation Laws? A A ∧ B = B ∧ A A V B = B V A 36 Q What are the De Morgan’s Laws?

A

¬(A V B) = ¬A ∧ ¬B

¬(A ∧ B) = ¬A V ¬B

Q

What are the Distribution Laws? A A ∧ (B V C) = (A ∧ B) V (A ∧ C) (A V B) ∧ (C V D) = (A ∧ C) V (A ∧ D) V (B ∧ C) V (B ∧ D) 38 Q What is the Double Negation Law? A ¬¬A = A 39 Q What are D-Type Flip Flops? A A sequential logic circuit used to store a single bit It has two stable states, which can be flipped between using an input signal 40 Q What are Full Adders?

A

Easier to process and takes up less space 45 Q Binary to decimal? 1101 A Write out the binary number under powers of increasing 2… 2^3 2^2 2^1 2^ 1 1 0 1 = 13 8 + 4 + 1 = 13 46 Q Decimal to binary? 82 A Write out the powers of 2 again, take away the greatest one possible till 0 is acquired. 82 - 64 = 18 18 - 16 = 2 2 - 2 = 0… done. 01010010

Q

Hexadecimal to binary? B A Split up the hexadecimal.. B 2 B = 11 2 = 2 11 = 1011 2 = 0010 (convert to binary) Then combine to make the full conversion = 10110010 = B 48 Q Hexadecimal to decimal? 4C A Same thing as binary to decimal, line up the hexadecimal number with the columns of increasing powers of 16… 16^2 16^1 16^ 4 C 3 4x256 + 12x16 + 3x1 = 1219 49 Q How can you tell if a floating point numbers in binary have been normalised?

Q

Each binary shift to the left or the right does what affect to the binary number? A Left = Doubling Right = Halving 54 Q What is a mask? A A mask can be applied to binary numbers by combining them withy a logic gate 55 Q What happens when you mask the binary numbers below with an AND, OR and XOR gates? 00101011 10111011 A AND = 00101011 XOR = 10010000 OR = 10111011 56

Q

What is a character set? A A published collection of codes and corresponding characters which can be used by computers for representing text 57 Q How many different characters could be represented through ASCII? A 0-127, so therefore 128 58 Q What else can you say about arrays, how do they start? A Zero indexed base 59 Q How does a 3D array select an item? (pseudocode ) Study These Flashcards A threeDimensionalArray = [[[12,8],[9,6,19]],[[241,89,4,1],[19,2]]] print(threeDimensionalArray[0,1,2]) » 19

Study These Flashcards A List values are stored non-contiguously, lists can also store more than one data types 63 Q What does it mean when data is stored in non-contiguous memory? Study These Flashcards A This means that they do not have to be stored next to one another in memory 64 Q Checks if the list is empty Study These Flashcards A list.isEmpty() 65 Q Adds a new value to the end of the list Study These Flashcards A list.append(value) 66 Q

Removes the value the first time it appears in the list Study These Flashcards A list.remove(value) 67 Q Searches for a value in the list Study These Flashcards A list.search(value) 68 Q returns length of list Study These Flashcards A list.length() 69 Q Returns the position of the item Study These Flashcards A list.index(value)