According to its structure I'd say that this is SEAL (<span>Software-Optimized Encryption Algorithm). It's difficult to describe how it works, because this kind of ciphers is very tricky. This algorithm uses 160 bit key and it uses 3 tables (R, S, T) to encode and decode.
I'll attach the image where you can see a process of creating a pseudo-random function:
</span>
Answer:
51015
Explanation:
Var b is a string, and it'll treat addition like <em>string concatenation </em>(aka just adding a message.) Since it's concatenation, it'll then turn the numbers/integers into strings.
This kind of behavior might be different depending on the language, though. Some languages might not allow this. (For example, C and C++)
Explanation:
public class Int_List
{
protected int[] list;
protected int numEle = 0;
public Int_List( int size )
{
list = new int[size];
public void add( int value )
{
if ( numEle == list.length )
{
System.out.println( "List is full" );
}
else
{
list[numEle] = value;
numEle++;
}
}
public String toString()
{
String returnStr = "";
for ( int x = 0; x < numEle; x++ )
{
returnStr += x + ": " + list[x] + "\n";
}
return returnStr;
}
}
public class Run_List_Test
{
public static void main( String[] args )
{
Int_List myList = new Int_List( 7 );
myList.add( 102 );
myList.add( 51 );
myList.add( 202 );
myList.add( 27 );
System.out.println( myList );
}
}
Note: Use appropriate keyword when you override "tostring" method
Answer:
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter a decimal value (0 to 15): ");
int num = scan.nextInt();
scan.close();
if (num < 0 || num >15) {
System.out.printf("%d is an invalid input\n", num);
} else {
System.out.printf("The hex value is %X\n", num);
}
}
}
Explanation:
Hopefully this example will get you going for the other assignments.