CTOOD Lab Manual
CTOOD Lab Manual
2024
Koneru
Lakshmaiah
Education
Foundation
Artificial
Intelligence &
Data Science
Department of AI&DS
Lab Manual
Computational Thinking for
Object Oriented Design
(23SC1203O)
2022-23 Odd Semester
Roll Number:
Name of the Student:
Lab Course Name:
Lab Course Code:
Year /Semester of Study:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In-Lab
Post Viva
Experiment Pre- Total Faculty
S.NO Date Lab Voce
Name Lab (5M) (50M) Signature
(5M) (5M)
Introduction to
1 Java
Programming lab
Implement
Java Program to
Check Whether
2 an Alphabet is
Vowel or
Consonant
Write a Java
Program to
3 Display
Alternate Prime
Numbers
Implement
Java Program to
4 Swap Two
Numbers Using
Bitwise Operator
Implement Java
Program to sort
5 the elements of
an array in
ascending order
Write a Java
Program to
Check if An
6 Array Contains a
Given Value or
not
Implement
Java Program to
7 read and write a
text into a file
Implement
Java Program to
8 Append Text to
an Existing File
Implement Java
program to
9 implement
Exception
Handling using
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
finally block
In-Lab
Post Viva
Pre- Total Faculty
S.NO Date Experiment Name Lab Voce
Lab (5M) (50M) Signature
(5M) (5M)
Introduction to AWT in
14 Java
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-1
Date: DD/MM/YYYY
Outcome: Students are able to identify and install the required software’s to work on Java
programming practical’s and understand the control statements and able to write java
program using control statements.
Pre Lab:
By searching Google find out what are the different tools for implementing java Programs.
2. Is Java a WORA?
6. Does returning a value from the loop body break the loop?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
10. What happens when we forget to put a break Statement in a case Clause of a switch?
11. When you use a return statement in Java, where does the control go?
12. How do you write an infinite loop using the for statement?
13. How do you write an infinite loop using the while statement?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
EXP1: Implement Java Program to Count Number of Digits in an Integer using while loop
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Procedure:
WEEK-2
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Date: DD/MM/YYYY
Outcome: Students are able to identify and understand the working of conditional
statements in Java.
Pre Lab:
2) What is classloader?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
6) When Is It Preferable to Use a Switch Over an If-Then-Else Statement and Vice Versa?
11) What are the different modifiers and its access levels?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
15) Could a Java class file exists even without filename and only extension(.java)?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Solution:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-3
Date: DD/MM/YYYY
Outcome: Students are able to identify the various operators in Java and understands the
working of operators in Java.
Pre Lab:
4) What is the difference between the Boolean & operator and the && operator?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
10) To invert the value of a Boolean, which operator would you use?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
EXP3:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Solution:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-4
Date: DD/MM/YYYY
Outcome: Students are able to identify and understands the bitwise operator.
Pre Lab:
7) If relational operators are present in an expression, what type of other operators may
be used?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
13) What is the output of a Bitwise AND (&) operation if both the inputs/operands are1s?
14) What is the output of a Bitwise OR (|) operation if both the inputs are 1s?
15) What is the output of a Bitwise AND (&) operation if one of the inputs/operands is 0?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
EXP4:
Solution:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-5
Date: DD/MM/YYYY
Outcome: Students are able to understand array concept and write Java program using
array concept.
Pre Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
EXP5:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
WEEK-6
Date: DD/MM/YYYY
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Outcome: Students are able to understand array and develops application of array.
Pre Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
Exp-6
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-7
Date: DD/MM/YYYY
Outcome: Students are able to understands and implements the file operation using Java .
Pre Lab:
1) Which class is used to create a directory in Java?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
Exp 7: Implement Java Program to read and write a text into a file
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-8
Date: DD/MM/YYYY
Pre Lab:
3) What are the classes used by Byte streams for input and output operation?
4) What are the classes used by character streams for input and output operations?
10) Which class is used to read characters and strings in Java from console?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-9
Date: DD/MM/YYYY
Outcome: Students are able to understand Exception Handling and implements it.
Pre Lab:
1. What is an exception?
4. Can we keep other statements in between try, catch and finally blocks?
5. Can we write only try block without catch and finally blocks?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
8. Does finally block get executed If either try or catch blocks are returning the control?
10. Can we keep the statements after finally block If the control is returning from the finally
block itself?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
Exp 9: Implement Java program to implement Exception Handling using finally block
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab: Practice more real world applications on exception handling.
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-10
Date: DD/MM/YYYY
Pre Lab:
4. Can we override a super class method which is throwing an unchecked exception with
checked exception in the sub class?
5. Which class is the super class for all types of errors and exceptions in Java?
9. What is the difference between the throw and throws keyword in Java?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
EXP 10: Create a Java Program to Implement User Defined Exception Handling
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Practice some more user defined exception problem examples in your home
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-11
Date: DD/MM/YYYY
Outcome: Students are able to understand Thread concept and implements it.
Pre Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
7. Why wait(), notify(), and notifyAll() methods are present in Object class?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-12
Date: DD/MM/YYYY
Outcome: Students are able to understand the Thread Synchronization and implements it.
Pre Lab:
3. Can two threads execute two methods (static and non-static concurrently)?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
10. Is it possible to call the run() method directly to start a new thread?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-13
Date: DD/MM/YYYY
Outcome: Students are able to create and manipulate user-defined class objects
Pre Lab:
5) What happens when you try to access an index that is out of bounds in an ArrayList?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
6) How can you iterate through an ArrayList using different types of loops? Provide code examples for
a for-loop, a for-each loop, and an iterator.
7) How do you check if an ArrayList contains a specific element? Provide a code example.
8) What are the time complexities of the main operations (add, get, remove) in an ArrayList?
9) Explain the difference between ArrayList and LinkedList. When would you prefer one over the
other?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
EXP 13: Implementation of Java Program for user defined class objects in Java Array List
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Practice more user defined class objects in Java Array List from real world applications.
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-14
Date: DD/MM/YYYY
Pre Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
6. How do you create a custom component in AWT?
10) What is the purpose of the Graphics2D class, and how does it differ from the Graphics class?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
WEEK-15
Date: DD/MM/YYYY
Outcome: Students are able to Design Labels, Buttons, Textboxes using AWT Components
Pre Lab:
2. How do you create a Button in AWT and add it to a frame? Provide a code example.
5. What method is used to set the maximum number of characters a TextField can accept?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
7. Explain how to add a tooltip to a Button in AWT.
10. What is the role of the ActionCommand property in AWT event handling?
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
In Lab:
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Post Lab:
Design a user registration form using Java AWT components, including labels, buttons, and
textboxes, to collect and display user information such as name, email, and password, ensuring
proper layout and event handling for form submission.
Pre-Lab (10M)
In-Lab(30M)
Post-Lab(10M)
TOTAL MARKS
(50M)
--------------------------------------------------------------------------------------------------------------------------------------------------------