A Java developer is asked to write a program that generates a sequence of random bytes for use as a cryptographic key. They search the Java API documentation for pseudorandom number generators and find two classes that could be used for the task: Random and
SecureRandom.
What are the likely differences between these two classes? Why is SecureRandom a better choice that Random?
a) With suitable illustration, discuss the relationship between processes and threads and how a process is created in Windows.
AP,6
b) Using the Windows API, write a C/C++ system program to delete a file in the Windows file system. Compile and run the program and copy the source code into your answer booklet.
CR,8
c) Discuss the Windows registry and how it is use in data/information management. AN,6
C. As the lead system engineer at AIT, you have been given raw data for hundred (100) students who sat for an entrance exam and you have been asked to write the pseudocode to summarize the results. For each student grade, it is written a “P” for pass and “F” for fail. 7 Use indentation and line numbers to highlight the flow of the program: Your pseudocode should address the following: i. Prompt the user to enter each result one after the other ii. Provide a count of the results of each type iii. Summarize the results indicating the number that passed or failed [5 marks] END OF PAPER
B. For larger datasets, a linear search may be inadequate or perhaps inefficient. What other search method can be employed to return the maximum number from a set of elements in an array. Explain your answer. [5 marks]
C. As the lead system engineer at AIT, you have been given raw data for hundred (100) students who sat for an entrance exam and you have been asked to write the pseudocode to summarize the results. For each student grade, it is written a “P” for pass and “F” for fail. Use indentation and line numbers to highlight the flow of the program:
Your pseudocode should address the following:
i. Prompt the user to enter each result one after the other
ii. Provide a count of the results of each type
iii. Summarize the results indicating the number that passed or failed
[5 marks]
A. A list data structure unlike stacks and queues ensure items are added and removed from any location within the list. This is useful for manipulating some forms of storage or processing requirements. a. Nodes in a list can be added in two ways. Using diagrams, explain the two (2) forms of adding a new node to an existing list. [4 marks]
b. Using diagrams, explain how the head pointer can be implemented in a single list such that it does not have to change during additions and deletions. Your resulting list should have five (5) regular nodes. [3 marks]
c. Provide the algorithm and supporting diagram for updating your list with a single node at the front of the List. Name the currently added node “Q”. Your resulting list will now have six (6) regular nodes. [3 marks]
Create a GUI application “Address Book” which can be used to store and search the information of different people. The information can be: name, phone no, email, street address etc. Your project should have the following features:
1. A GUI where user can input the information of a particular people
2. A file where all information are stored. (You will have to append new info to the file. Otherwise the previous information will be lost.
3. A GUI in which the user will be able to see all the information, sorted by name. The information must come from the file where you stored user information. (Hint: use JTextArea to show all user info)
4. A GUI where the user will be able to search a person using his name or phone no. The search result should show the info of all the matched person
5. A GUI where the user will be able to edit the information of a specific person.
import java.util.EmptyStackException;
public class IntStackTest implements IntStack{ private int top = -1;
private int[] data;
private static final int DEFAULT_CAPACITY = 10;
public IntStackTest() {
data = new int[DEFAULT_CAPACITY];
}
public void push(int item) {
if (top == data.length - 1) resize(2*data.length);
data[++top] = item; }
public int pop() {
//if (isEmpty()) throw new EmptyStackException();
return data[top--]; }
private void resize(int newCapacity) { int[] newData = new int[newCapacity]; for (int i = 0; i <= top; i++) {
newData[i] = data[i]; }
data = newData; }
public static void main(String[] args) { int x;
IntStack s = new IntStackTest(); s.push(7);
s.push(4);
s.push(18);
4
x = s.pop(); System.out.println("pop() ---> " + x ); x = s.pop(); System.out.println("pop() ---> " + x ); x = s.pop(); System.out.println("pop() ---> " + x );
} }
A. Provide a graphical representation of the Stack when the above code is run
A. A single linked list provides pointers to the next node in the sequence.
Consider the below structure of the linked list and answer the questions that follow:
Assuming the front is the 1st node and the back is the Nth node, state and explain the running times for the below:
i. Find a node from the front. [2 marks]
ii. Find a node from the back. [2 marks]
iii. Insert a node at the front. [2 marks]
iv. Insert a node at the back. [2 marks]
v. Erase a node from the front. [2 marks]
vi. Erase a node from the back. [2 marks]
For this assignment, you are required to understand the Problem Frames and then model the following requirements using problem frames:
For an e-commerce store, an item is added to the shopping cart, as soon as, the "Add-to-Cart" button is pressed, however, whether the item can be processed for payment, will depend on whether the item is in inventory or not, when the customer is trying to make the payment. If the item is not in inventory, when the customer is trying to pay for it, then the customer should be informed, and the item is removed from the customer's cart.
B. Consider a problem to find the student who had the highest GPA for the 2020/2021 academic year. Using the below data set, answer the questions that follow: StudentGPA[2,2.5,4,4,4,3,3.5,3.3,3.1,2.1] i. Explain how a binary search algorithm can be used to solve this problem. [2.5 marks] ii. Explain how a sorting algorithm can be used to solve this problem. [2.5 marks] iii. Write the algorithm using the binary implementation. [2.5 marks] iv. Write the algorithm using the sorting implementation. [2.5 marks