0% found this document useful (0 votes)
7 views5 pages

Java previous year paper

The document outlines the structure and content of class tests and examinations for a B.Tech course in Object-Oriented Programming using Java at the Institute of Engineering & Technology, Lucknow. It includes various topics such as the compilation process, data types, inheritance, exception handling, and threading in Java, along with specific programming tasks and questions. The tests are designed to assess students' understanding of key concepts and their ability to apply them in practical scenarios.

Uploaded by

Thakur Shab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

Java previous year paper

The document outlines the structure and content of class tests and examinations for a B.Tech course in Object-Oriented Programming using Java at the Institute of Engineering & Technology, Lucknow. It includes various topics such as the compilation process, data types, inheritance, exception handling, and threading in Java, along with specific programming tasks and questions. The tests are designed to assess students' understanding of key concepts and their ability to apply them in practical scenarios.

Uploaded by

Thakur Shab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
Class Test- : (Subject: Object-Oriented Programming using Java- Date: 07.05.2024 Duration: 1:00 hr. Attempt all questions. Bach question ws Department of Computer Science & Engineering Institute of Engineering & Technology Lucknow 1, Session: 2023-24, Course: B.Tech, Semester-IV ICS-402) Max Marks: 20 carries equal marks. Describe the compilation process of the Java Program. Write and describe the size and ranges of primitive data types applicable in Java programming. OR What is typecasting? Explain the data types that have no loss of information. Explain the structure of the for loop. Explain its different variants. Whiat is inheritance? Describe important types of inheritance used in Java programming. OR Write a program in Java to determine the compound and simple interest in Java using a single class other than the main class. [ Simple interest=principle amount*rate*Time /100.] [Total Amount=principle amount(1 +(rate/100))*Time] Write a Java program that explains the method overloading. OR Write a Java program that explains the method overriding. Waite you" Gall Naber + Department of Computer Science & Engineering, Institute of Engineering & Technology Lucknow ‘Class Test- Il, Session: 2023-24, Course: B.Tech, Semester-1V (Subject: Object-Oriented Programming using Java- 1CS-402) Date: 11.06.2024 Duration: 1:00 hr, Max Marks: 20 Attempt all questions. Each question carries equal marks. 1. Diereniate between(lasDand intertce 2marks] _ — oR Iastrate the diferent forms of interface implementation. 2. Chasity the JAVA APL packages. [3 marks] e oR Describe the accessing of classes of Java packages in he form of table. Draw and explain the tate tension diagram ofthe thread [3 marks] OR Define the EXCEPTION. Categorize the Java exception. ‘Create a try block that will ikely generat thee exception types and then incorporate necessary catch blocks to catch and handle them appropriately. [4 marks] Describe the synchronization process using threads. Illustrate with an example, [4 marks} 6. Priority of thread is defined in the given code. Correct the code if there is any bug. {2 marks} A{Giass threat extends Thread { Public void run() { ‘System.out printin(This is Threadi class"); y wehass } oss (Classthread2 extends Thread { Public void run() { System.out printin("This is Thread2 class"); t = ibieltessiweaePir LB ter mmaingSting fb Thread t1= new thread10; ¥ . i theoati20, Ticoal 2 12 Meal 2C IS : Yi.selPriorty(Thread Max Priosty): tt.rung; rund; MAX-P RTORT Ty oR ws tperd fou long ~ Towed 2 ‘The Sleep() method has been demonstrated in the following code. Will this code compile successfully? If not suggest the correction. lon ea i- NO (Class A extends Tread C Pubic void run) Ff eri e y Class TrreadClass C Public static void main(Stringt] args) { Aasnew Ad: astatg, } y The following code catches an Arithmetic Exception Willthis cade work? If nat. why? 2 marks] Class except t Pubic state void msin( String egsI) ‘ y t Int nelnteger.parsettargst0: int ntsteteger parsebs(ergs(tD: ; ccstch(AathmeticException ex) i ‘System out printn(arthmetic Exception Bock 19); d catchtariteneticéxception ex) ( ‘System out prntincAithemetic Exception Bock?) y d OR ‘Custom exception bas been rete in the cade given below, Conect he ead ‘lass myexception extends Exception « pryereoton (tng 9) \ Severe y class exceps is pb tat od an Seg as Mergsto}e="Heio?) System. ou print Sing is igh): ee i ° “Throw new myexceptionC invalid Sting, stcrimyecenten on ‘Systomout prntn(ex getmessage)): a age? 2, Printed pages: 02 ‘Subject Code: ICS 402 Roll Noz ]2]z lolol |2] °| sf of olol4 B.TECH. (SEM IV) EVEN SEMESTER EXAMINATION 2023-24 OBJECT ORIENTED PROGRAMMING USING JAVA TIME: 3 hrs.] (Max. Marks: 70} Note: Attempt All Questions. Al Question carry equal marks. QU. Answer ALL parts. Marks (a) Write and explain the important object-oriented characteristics in Java in brief. 3.5 (b) Explain the compilation process of a Java program. 35 (©) Classify data types in Java along with their size and types of values. 35 or Write the backslash characters used in Java along with their description. (@) Explain the structure of the for loop. Explain its different variants. 35 or Describe exiting from a loop using the break statement. Q2. Answer ALL parts. (@) Describe the important types of inheritance applicable in Java. Explain how it 7 helps to create new classes quickly. (b) \_ Define a superclass Parent with a method showMessage(). Create a subclass Child 7 that tries to override showMessage(). Mark showMessage() in Parent as final and demonstrate the compilation error that occurs when trying to override it. oR Create a class Calculator with two methods with the same name but different parameters add(int a, int b) and add(int a, int b, int ¢). Write a main method to demonstrate calling both methods. Explain the outputs. Q3. Answer ALL parts. (@) Define the stream classes. Describe and differentiate between Byte stream classes 7 and character stream classes. (b) Write the process of file creation in Java. Write a program in Java for copying the 7 characters from one file into another file and explain. oR Lfite common Java exceptions with descriptions in tabular form. Apply with descriptions try, catch, and finally keywords in a non-trivial example. Q4, Answer ALL parts. (a) Write the importance of threads in Java programming. How a thread can be 7 created? Describe the different states of a thread and explain the transition from. one state to another. (b) Describe the process of inter-thread communication. Write a program in Java in 7 which a thread takes input from another thread. or Define Lamda expressions in Java. Describe the following types of Lamda expression with: (i) Zero parameter (ii) Single parameter (iii) Multiple Parameters. eee aS lies 402_suty 2024) Printed pages: 02 QS. Answer ALL parts, (a) Describe the interfaces in the Java collection tiamework. i. (b) Explain the AbstractL ist class and LitkedList class in Java collections with sell 7 explanatory programs, or Explain the ereation and updation ofa linked list by writing. a progeam in fava. ESS TERR pI AT TET {HC3492_suny 2024), a

You might also like