Consider two linked lists list1 with Integer values [1,2,3] and list2 with Integer values [4,5,6,7,8,9]
Suppose the merge method is called on list1 with list2 as parameter.
How many time will the following loop while((ptrThis != null) && (ptrParam != null)) iterate? Blank 1. Fill in the blank, read surrounding text.
After 3 iterations what will the value of ptrThis be? Blank 2. Fill in the blank, read surrounding text.
What will the value of ptrParam be? Blank 3. Fill in the blank, read surrounding text.
Do the pointer in both lists reach null at the same time? Yes/No Blank 4. Fill in the blank, read surrounding text.
What follows is a fill in the blank question with 9 blanks.
The curly bracket used in java to enclose units of code can not be used in a fill in questions. For this
questions the curly brackets will be substituted with comments. Interpret the open and close comments as curly brackets.
Given the following method with an array values [7,2,5,8,3,9]
public static int sumValues(int index)
//open method
if(index>=values.length)
return 0;
else
return values[index] + sumValues(index +1);
//close method
Is sumValues(4) a valid call? Yes/No Blank 15. Fill in the blank, read surrounding text.
If so what is returned from the method? returned value or No Blank 16. Fill in the blank, read surrounding text.
Is sumValues(1) a valid call? Yes/No Blank 17. Fill in the blank, read surrounding text.
If so what is returned from the method? returned value or No Blank 18. Fill in the blank, read surrounding text.
Albert Einstein teaches a business class at Podunk University. To evaluate the students in this class, she has given four tests. It is now the end of the semester and Alberta would like to have a program that inputs each student’s test scores and outputs the average score for each student and the overall class average. (Hint: The outer loop should allow for Ms. Einstein to input all the students, one by one, and the inner loop should accept the four exam scores and compute the average for each student
Write a Python program to print the following string in a specific format
Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky.
Twinkle, twinkle, little star,
How I wonder what you are
Write a Python program to print the following string in a specific format
Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are
Polynomial
Given polynomial,write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1+....+C1x+C0 format.
Input
The first line contains a single Integer N.
Next N lines contain two integers Pi,Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.
Sample Input 1
5
0 2
1 3
2 1
4 7
Sample output 1
7x^4 + 6x^3 + x^2 + 3x + 2
Sample input 2
4
0 5
1 0
2 10
3 6
Sample output 2
6x^3 + 10x^2 + 5
Add two Polynomials
Given two Polynomials A and B,write a program that adds the given two Polynomials A and B.
Sample input 1
4
0 5
1 0
2 10
3 6
Sample Output 1
Sample Input 2
4
0 5
1 0
2 10
3 6
3
0 1
1 2
2 4
Sample output 2
6x^3 + 14x^2 + 2x + 6
Tic-Tac-Toe game
Abhinav and Anjali are playing the Tic-Tac-Toe game.Tic-Tac-Toe is a game played on a grid that's three squares by three squares.Abhinav is O, and Anjali is X.Players take turns putting their marks in empty squares.The first player to get 3 of her marks in a diagonal or horizontal, or vertical row is the winner.When all nine squares are complete,the game is over.If no player has three marks in a row,the game ends in a tie.Write a program to decide the winner inthe Tic-Tac-Toe game.
Input
The input will be three lines contain O's and X's separated by space.
Sample Input 1
O X O
O X X
O O X
Sample Output 1
Abhinav Wins
Sample input 2
O O X
X X O
X O O
Sample output 2
Anjali Wins
Prefix Suffix
write a program to check the overlapping of one string's suffix with the prefix of another string.
Sample input 1
ramisgood
goodforall
Sample output 1
good
Sample input 2
finally
restforall
Sample output 2
No overlapping
Write a file copy program that prompts the user to enter the name of a text file to act as the source file and the name of an output file. The program should use the toupper() function from ctype.h to convert all text to uppercase as it’s written to the output file. Use standard I/O and the text mode