Full Transcript

# Instructions **Section-A** 1. Explain Polymorphism in Java, with an example. (15 marks) 2. Write a Java Applet program to draw an image within a circle (15 marks) 3. Create an AWT program in Java that displays the message "Hi Nidhi, how are you?" when a button is clicked. (15 marks) 4. Write...

# Instructions **Section-A** 1. Explain Polymorphism in Java, with an example. (15 marks) 2. Write a Java Applet program to draw an image within a circle (15 marks) 3. Create an AWT program in Java that displays the message "Hi Nidhi, how are you?" when a button is clicked. (15 marks) 4. Write a Java program to determine if a number is a "spy number". A number is a spy number if the sum of its digits equals the product of its digits. Example: 1124 is a spy number. (15 marks) 5. Create a Java program to print the following pattern: ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ``` (15 marks) **Section-B** 6. Explain the differences between Java and C++. (15 marks) 7. Explain any five string functions in Java, with examples. (15 marks) 8. Write a Java program to get a string input from the user, then count the words and characters in that string. (15 marks) **Note:** Attempt any three questions from Section B. Each question carries 15 marks.

Use Quizgecko on...
Browser
Browser