MAJOR EXAM ( DATAS STRUCTURES and ...) Flashcards
studyhi yawaa ka
Q: What type of elements does an array contain?
A: An array contains elements only of the same type.
Q: How do you instantiate an array in Java?
A: int arr[] = new int[3] is how to instantiate an array in Java.
Q: What is the syntax to declare a multidimensional array in Java?
A: The syntax is either int[][] arr; or int arr[][];.
Q: How are elements accessed in an array versus a linked list?
A: Elements in an array are accessed randomly, while in linked lists, elements are accessed sequentially.
Q: What are the correct ways to declare an array in Java?
A: The correct ways are:
int arr[] = new int[5];
int [] arr = new int[5];
int arr[] = new int[5];
Q: Which sorting algorithm runs faster for small arrays but is impractical for large arrays?
A: Insertion sort runs faster for small arrays but is impractical for sorting large arrays.
Q: How does merge sort work?
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.
Q: What is an advantage of selection sort over other sorting techniques?
A: Selection sort is an in-place sorting algorithm, meaning it does not require additional storage.
Q: What method does bottom-up merge sort use to implement sorting?
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.
Q: Why is merge sort called a merging algorithm?
A: Merge sort is called a merging algorithm because it sorts by merging the sorted versions of smaller parts of the array.
Q: Why is quick sort considered the fastest known sorting algorithm?
A: Quick sort is considered the fastest known sorting algorithm due to its highly optimized inner loop.
Q: What is shell sort, and why is it considered an example of internal sorting?
A: Shell sort is an internal sorting algorithm because the sorting of elements is done internally using an array.
Q: How does quick sort implement sorting?
A: Quick sort implements sorting by partitioning the input array about the pivot.
Q: What do transpositional ciphers do in cryptography?
A: Transpositional ciphers rearrange the order of letters in a message using a predefined method.
Q: What is a cipher in cryptography?
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.
Q: What is another name for the shell sort algorithm?
A: The other name for shell sort is “diminishing decrement sort” because the distance between comparisons decreases as the algorithm runs.
Q: In asymmetric key cryptography, who keeps the private key?
A: The private key is kept only by the receiver of the message.
Q: What is cryptanalysis?
A: Cryptanalysis is the field of study that involves intentionally trying to breach a cryptographic scheme to find flaws and insecurities.
Q: Which cipher provided voice privacy in GSM cellular telephone protocol and when was it discontinued?
A: The A5/2 cipher provided voice privacy in GSM cellular telephone protocol and was discontinued in 2006 due to its weakness.
Q: What is Transport Layer Security (TLS)?
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.
Q: What is traffic analysis, and why is it considered a passive attack?
A: Traffic analysis is a passive attack where the attacker monitors the pattern of transmission without modifying any part of the data.
Q: What are the three principles of data security?
A: The principles of data security are Data Confidentiality, Data Integrity, and Authentication.
Q: What is a data structure?
A: A data structure is a set of associations or relationships (structure) involving the combined elements.
Q: What is data encapsulation?
A: Data encapsulation is the process of packaging together a collection of data values with the operations on those values.