Write a program that reads in a number and prints out the letter L using '*' characters with each line in the L having width n. Further, the length of the horizontal bar should be 4n, and that of the vertical bar (i.e. not including the portion overlapping with the horizontal bar) should be 3n. Thus for n=3 your program should print
Array Write a Java program to find frequency of each character in a given string. Also display the length and the most frequent among the characters
Write a Java program to find a certain character in a string and replace it with a new character. Allow user to enter a string, find character and the replace character. Display the new string.
Write a Java program that allow the user to input for the two angles A, and B (all in degrees), and the side a of an oblique triangle. Thereafter, solve for the triangle using laws of sine. Draw the user interface. Note: The sum of the interior angle of a triangle is always equal to 180.
Suppose we have a 5 x 5 image.The pixels in the top row are numbered 0 through 4 left to right,the ones in the second row from the to are numbered 5 through 9 left to right, and so on. Suppose there is a 'T' in the middle. The horizontal bar is in the middle of the second row, and 3 pixels wide. The vertical bar is in the middle of the third column and is also 3 pixels wide. Only pixels of the 'T' are black, rest are white.
1 point
Suppose we flatten the image into an array(let's call it A, and it is indexed from 0) such that pixel number i goes into the array at index i. What is the index of a pixel in column a and row b? (Note that first row has a=0 and first column has b=0)
5 * j + i
5 * j * i
5 * i + j
5 * i + 5 * j
1 point
Which of the indices in the array correspond to black pixels ?
3
8
11
13
What is the total number of white pixels?
1 point
1 point
For the pixel at index i in the array, what are the corresponding row and column number (first row has row number 0, and second row has 1)?
Note: floor(x) is the largest integer that is less than or equal to x. ceil(x) is the smallest
integer that is greater than or equal to x.
floor(i/5), i%5
i%5, floor(i/5)
ceil(i/5), i%5
floor(i/5)+1, i%5
Fill in the blank in the following program that draws a figure resembling the letter 'Z' with sides (50, 100, 50) and the angle between them to be 60 degrees.
Remember that the turtle starts at the center of the canvas and facing right.
left(180); forward(50); right(B1); forward(B2); left(B3); forward(50);
When can we use greedy algorithm?
Suppose, DS= 1000 H, BX= 1200 H, DI= 20 H, Oxyzen= 20H. Then, calculate the physical address of the source for the following instruction in real mode:
MOV DX, Oxyzen[BX+ DI].
A student wants to analyse accuracy of range measurements from a laser range sensor. He is required to take 5 measurements for distance of 1.5, 2.5 and 3.5 meters. Construct a complete C++ program to input all the measurements and display the measurements’ average of each distance. Your program should use array of struct to store the sensor measurements. Figure 3 is a sample output of program execution.
Suppose we have a 5 x 5 image.The pixels in the top row are numbered 0 through 4 left to right,the ones in the second row from the to are numbered 5 through 9 left to right, and so on. Suppose there is a 'T' in the middle. The horizontal bar is in the middle of the second row, and 3 pixels wide. The vertical bar is in the middle of the third column and is also 3 pixels wide. Only pixels of the 'T' are black, rest are white.
Q1. Suppose we flatten the image into an array(let's call it A, and it is indexed from 0) such that pixel number i goes into the array at index i. What is the index of a pixel in column a and row b? (Note that first row has a=0 and first column has b=0)
5 * j + i
5 * j * i
5 * i + j
5 * i + 5 * j
Q2. Which of the indices in the array correspond to black pixels ?
3
8
11
13
Q3. What is the total number of white pixels?
For the pixel at index i in the array, what are the corresponding row and column number (first row has row number 0, and second row has 1)?
Note: floor(x) is the largest integer that is less than or equal to x. ceil(x) is the smallest
integer that is greater than or equal to x.
floor(i/5), i%5
i%5, floor(i/5)
ceil(i/5), i%5
floor(i/5)+1, i%5