1. Write a program to determine if a given substring exists within a larger string. Both inputs should be entered through console.

2. Given:

public class Boxer1 {
Integer i;
int x;

public Boxer1(int y) {
x=i+y;
System.out.println(x);
}

public static void main(String[] args) {
new Boxer1(new Integer(4));
}
}

What is the result? Complete the program to confirm the results.

3. A news magazine wants to conduct a survey across the four research universities in Alberta. For each university, the magazine wants to gather the number of departments, the number of students doing research in each department, courses taken by each research student, and marks scored by these students in courses. Design, develop, and implement a Class to capture this information.

4. Distinguish between buffered and unbuffered I/O in Java with example programs. Explain the difference between the two.

6. Implement a Class called ‘Electric Car’. Identify and explain its key States and Behaviour. Also test the functionality of the class using a wrapper class.

7. Describe a Class called ‘People’. Identify and explain some of its key States and Behaviour. Discuss if it is appropriate to embed all States and all Behaviour about people in a single Class? Implement the People Class in Java and test its functionality.

8. What are the different types of inheritance? Create a hierarchy of Classes for a top Class called “Computer”. Explain various States and Behaviour inherited between Classes in this hierarchy. Implement the Class Computer in Java.

9. Write an Interface named ‘Java Programming Language’ and discuss its implications in the context of different types of Operating Systems and Hardware. Create a Class in Java to implement this Interface.

10. Write a program to encode and decode a string using StringTokenizer. The give text will be “Java Programming”. When u find letter ‘a’ in the string, it should be replaced by @. When you find a space character, it should be replaced by the character ~, 3 times. So, the output of encode will be J@v@~~~Progr@mming. Decode should return the original string “Java Programming” given the encoded string as input. Test the program with various inputs.

11. What are bitwise operators? Explain with an example. Write a program to print 1’s complement and 2’s complement of a binary number.

12. Write a program to print the first 20 number of the Fibonacci series using recursion.

13. Write a program to print a triangle as shown below, given an input number. This triangle is printed when the input is 3. There are 5 spaces between elements in the triangle.

14. The following code snippets, each, find all substrings within a given string. That is, given a string of length ‘n’ each of the following code snippets will return ‘n * (n + 1) / 2’ substrings. Walk through the code snippets by commenting each line of the code and explain how each snippet differs from the rest in computing substrings.

16. Given a number (maximum 99), write a program to determine and print the non-prime numbers, in the range from 0 to that input number, and store the prime-numbers in a singly-linked list. Finally, print the elements stored in the singly-linked list.

17. A school hallway has N number of lockers, N is to be input up to a maximum of 100. A student goes through the hallway opening every locker. Then, a second student goes down the hallway closing every other locker. A third student goes down the hallway, and at every third locker, opens it if it is closed and closes it if it was opened. This continues on for a total of N students opening and closing lockers. Write a program to compute how many lockers remain opened when N students are finished with this exercise.

18. What is the importance of finally block in exception handling? Explain with an example program.

19. Write a program that simulates a random walk of a robot in an empty room. The room is a (n x n) square and the robot starts in position (1 x 1). The robot can move east, move west, move north, or move south, at a time. When the robot hits a boundary and cannot proceed further it makes a random turn and attempts to continue its walk. Define an exit location in this room and allow the robot to walk until it finds the exit. Print the current location of the robot on the screen at every move. Stop the program if the robot failed to find the exit within 10000 moves. Each move should be randomly generated.

20. Write a program that accepts a sequence of numbers and determines whether the input numbers represent a magic square. A magic square is one in which the summation of both diagonals, all rows, and all columns add up to the same number. The program should print the total if the input numbers represent a 2D magic square. The program prints -1 if the rows do not all add up to the same number. The program prints -2 if the columns do not all add up to the same number. The program prints -4 if the diagonals do not all add up to the same number. The program prints -8 if the summation of all of the rows agree, the summation of all of the columns agree, and the summation of both diagonals agree, but these are not the same sums.

21. Write a program that exemplifies the difference between Data Streams and Object Streams.

22. Write a program that writes the frequency of all alphabets from an input file (e.g., ‘a’ – 25 times, ‘b’ – 17 times, and so on) into an output file. Also, the program should write the frequency of the size of words (e.g., 1 letter words – x times, 2 letter words – y times, and so on). Use the program CountLetter.java (http://docs.oracle.com/javase/tutorial/essential/io/QandE/CountLetter.java ) as a reference.

23. What is a Java Virtual Machine (JVM)? How does JVM allow Java to run on almost any computer platform? Explain in detail.

24. Create a Circle.java class that uses the value of a circle’s radius to compute the circle’s area and circumference. Then, create another class called Cylinder.java. A cylinder of height ‘h’ can be thought of as ‘h number of circles’ stacked on top of each other. Implement the methods cylinderVolume() and cylinderSurfaceArea() in Cylinder.java that uses Circle’s circleArea() and circleCircumference() methods, respectively.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.