Answer:
The solution code is written in Python:
- mystery_string = "Programming"
- output = ""
-
- for x in mystery_string:
- output += x
- print(output)
Explanation:
Firstly, create a variable mystery_string to hold a random string (Line 1).
Create an output variable to hold an output string (Line 2).
Create a for-loop to traverse the mystery_string character by character (Line 4). In the iteration, get a character from the mystery_string, and concatenate it with output string (Line 5). Print the output string (Line 6) before proceed to the next iteration.
Answer:
The method definition to this question can be given as:
Method definition:
public void clear(int[] arr, int num) //define method clear.
{
if (num == 0) //if block
{
return 0; return value.
}
else //else block
{
arr[num - 1] = 0; //assign value in arr.
return arr[]; //return value.
}
}
clear(arr, num - 1); //calling
Explanation:
The description of the above method definition as follows:
- Firstly we define a method that is "clear" that does not return any value because its return type is "void". This method accepts two integer variables that are "arr[] and num" where arr[] is an array variable and num is an integer variable.
- Inside a method, we use a conditional statement in if block we check that num variable value is equal to 0. if this condition is true so, it will return 0 otherwise it will go to else block in else block it will assign value in variable arr[num-1] that is "0" and return arr value.
Answer:
public static void main(String[] args) {
String ing[] = {"ten","fading","post","card","thunder","hinge","trailing","batting"};
for (String i: ing){
if (i.endsWith("ing")){
System.out.println(i);
}
}
}
Explanation:
The for-loop cycles through the entire list and the if-statement makes it so that the string is only printed if it ends with "ing"
Answer:
The hexadecimal equivalent of the encrypted A is C2
Explanation:
Given
Encrypted binary digit of A = 11000010
Required
Hexadecimal equivalent of the encrypted binary digit.
We start by grouping 11000010 in 4 bits
This is as follows;
1100 0010
The we write down the hexadecimal equivalent of each groupings
1100 is equivalent to 12 in hexadecimal
So, 1100 = 12 = C
0010 is represented by 2 in hexadecimal
So, 0010 = 2
Writing this result together; this gives
1100 0010 = C2
Going through the conversion process;
A is first converted to binary digits by shifting a point to the left
A => 11000010
11000010 is then converted to hexadecimal
11000010 = C2
Conclusively, the hexadecimal equivalent of the encrypted A is C2
Answer:
Did you get the answer yet or not or should i sent it?
Explanation: