Professional Documents
Culture Documents
Any evidence of plagiarism or copy will be punishable according to the proctorial rules of UIU
1
4. The following code will not compile. What is wrong with the following program? [1]
}
}
5. Write a program in Java, that will take a student id of UIU as input/parameter to the main program [2]
and prints the department of the student. Note that student id of EEE starts with 012, CSE starts
with 011 and BBA starts with 111.
6. Write a class in Java called ‘Time’. It will have three integer fields. Create a parameterized constructor. [2]
Also write a toString() method so that the output of the main method is as following:
7. Write a function in java that will take a String as input. It will return another string where all the [2]
words in the string are separated by ‘*’ instead of spaces.
Page 2