MAJOR EXAM ( DATAS STRUCTURES and ...) Flashcards

studyhi yawaa ka

1
Q

Q: What type of elements does an array contain?

A

A: An array contains elements only of the same type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Q: How do you instantiate an array in Java?

A

A: int arr[] = new int[3] is how to instantiate an array in Java.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Q: What is the syntax to declare a multidimensional array in Java?

A

A: The syntax is either int[][] arr; or int arr[][];.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Q: How are elements accessed in an array versus a linked list?

A

A: Elements in an array are accessed randomly, while in linked lists, elements are accessed sequentially.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Q: What are the correct ways to declare an array in Java?

A

A: The correct ways are:

int arr[] = new int[5];
int [] arr = new int[5];
int arr[] = new int[5];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Q: Which sorting algorithm runs faster for small arrays but is impractical for large arrays?

A

A: Insertion sort runs faster for small arrays but is impractical for sorting large arrays.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Q: How does merge sort work?

A

A: Merge sort divides the array into two halves, applies the merge sort algorithm to each half individually, and then merges the two sorted halves together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Q: What is an advantage of selection sort over other sorting techniques?

A

A: Selection sort is an in-place sorting algorithm, meaning it does not require additional storage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Q: What method does bottom-up merge sort use to implement sorting?

A

A: Bottom-up merge sort uses an iterative method, beginning by merging adjacent arrays of size 1, then merging arrays of size 2, and so on.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Q: Why is merge sort called a merging algorithm?

A

A: Merge sort is called a merging algorithm because it sorts by merging the sorted versions of smaller parts of the array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Q: Why is quick sort considered the fastest known sorting algorithm?

A

A: Quick sort is considered the fastest known sorting algorithm due to its highly optimized inner loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Q: What is shell sort, and why is it considered an example of internal sorting?

A

A: Shell sort is an internal sorting algorithm because the sorting of elements is done internally using an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Q: How does quick sort implement sorting?

A

A: Quick sort implements sorting by partitioning the input array about the pivot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Q: What do transpositional ciphers do in cryptography?

A

A: Transpositional ciphers rearrange the order of letters in a message using a predefined method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Q: What is a cipher in cryptography?

A

A: A cipher is a method to implement encryption and decryption of messages traveling in a network, used to increase the confidentiality of the messages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Q: What is another name for the shell sort algorithm?

A

A: The other name for shell sort is “diminishing decrement sort” because the distance between comparisons decreases as the algorithm runs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Q: In asymmetric key cryptography, who keeps the private key?

A

A: The private key is kept only by the receiver of the message.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Q: What is cryptanalysis?

A

A: Cryptanalysis is the field of study that involves intentionally trying to breach a cryptographic scheme to find flaws and insecurities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Q: Which cipher provided voice privacy in GSM cellular telephone protocol and when was it discontinued?

A

A: The A5/2 cipher provided voice privacy in GSM cellular telephone protocol and was discontinued in 2006 due to its weakness.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Q: What is Transport Layer Security (TLS)?

A

A: TLS is a cryptographic protocol used to secure HTTP connections, providing strong message authentication and key-material generation to prevent eavesdropping, tampering, and message forgery.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Q: What is traffic analysis, and why is it considered a passive attack?

A

A: Traffic analysis is a passive attack where the attacker monitors the pattern of transmission without modifying any part of the data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Q: What are the three principles of data security?

A

A: The principles of data security are Data Confidentiality, Data Integrity, and Authentication.

17
Q

Q: What is a data structure?

A

A: A data structure is a set of associations or relationships (structure) involving the combined elements.

17
Q

Q: What is data encapsulation?

A

A: Data encapsulation is the process of packaging together a collection of data values with the operations on those values.

18
Q: What can be used as a key in a cryptographic algorithm?
A: Integer values, a square matrix, and an array of characters can be used as keys in a cryptographic algorithm.
19
Q: What is used to encrypt plaintext in cryptography?
A: A cryptographic algorithm works in combination with a key, which can be a word, number, or phrase, to encrypt plaintext.
20
Q: What does the PUSH operation do in a stack?
A: The PUSH operation inserts the element on top of the most recently inserted data.
20
Q: When is a stack considered empty?
A: A stack is empty if the isEmpty() method returns true.
20
Q: What does the POP operation do in a stack?
A: The POP operation removes the element currently pointed to by the top.
20
Q: What is stack overflow?
A: Stack overflow occurs if a PUSH operation is called on a full stack.
21
Q: What does the stackTop operation in the stack ADT do?
A: The stackTop operation returns the topmost element of the stack.
22
Q: What type of operation is addWater() in the water tank ADT?
A: addWater() is a transformer operation in the water tank ADT.
22
Q: What is the condition for the isEmpty() method in a water tank ADT to return true?
A: The isEmpty() method returns true if the water level of the water tank is equal to 0.
23
Q: What is the purpose of the ~waterTank() operation in the water tank ADT?
A: The ~waterTank() operation is a destructor in the water tank ADT.
24
Q: What happens when a new item is inserted into a non-empty and non-full stack?
A: The new item becomes the new last element.
25
Q: What happens to the topmost item after a POP operation in a stack?
A: The next oldest item becomes the topmost item.
26
Q: What do Abstract Data Types (ADTs) focus on?
A: ADTs focus on the WHAT rather than the HOW.
27
Q: What technique does a stack implement?
A: A stack implements the last-in, first-out (LIFO) technique.
27
Q: What happens if POP is called on an empty stack?
A: Stack underflow occurs.
27
Q: What are the operations involved in Abstract Data Types (ADTs)?
A: The operations are creators, transformers, observers, and input/output.
28
Q: What is a general tree?
A: A tree is said to be a general tree if it has at least three child nodes.
28
Q: What happens if POP is called on a full stack?
A: The topmost element is deleted.
28
Q: What types of data structures are general trees and binary trees?
A: They are considered hierarchical data structures.
29
Q: What type of data structures are stacks and queues?
A: Stacks and queues are linear data structures.
30
Q: What type of data structure is a tree?
A: A tree is a hierarchical data structure.
30
Q: What is abstraction in data structures?
A: Abstraction is a type of data structure that enables us to view something as a high-level object while temporarily ignoring the underlying details.
31
Q: What are the benefits of using abstraction?
A: Abstraction helps in understanding complex systems and makes things easier to absorb and manipulate.
32
Q: What does the "Address" attribute in data abstraction refer to?
A: Address refers to the location of data in memory.
33
Q: What is the "Name" attribute in data abstraction?
A: Name is a textual label used to refer to a variable or data in the text of the program.
33
Q: What is "Scope" in terms of data abstraction?
A: Scope is a set of statements in the text of the source program in which the variable is said to be visible.
34
Q: What are examples of hardware data types?
A: Examples include integers, floats, and characters.
34
Q: What are virtual data types?
A: Virtual data types are not directly represented by hardware; examples include arrays, structures, sets, and pointers.
34
Q: How do Abstract Data Types (ADTs) benefit programmers?
A: ADTs free programmers from the limits imposed by a specific programming language.
35
Q: What type of relationship do hierarchical data structures have?
A: Hierarchical data structures have a 1-to-many relationship.