├── Competitive Coding Test ├── Top 500 │ ├── README.md │ ├── CTP5.py │ ├── CTP1651.py │ ├── CTP8.py │ ├── CTP9.py │ └── CTP1553.py └── Top 100 │ └── CTP1186.py ├── Java Course - Lesson Plan - September - 2019 ├── Lab-25 │ ├── README.md │ ├── Question15.java │ ├── Question05.java │ ├── Question06.java │ └── Question02.java ├── Lab-26 │ └── README.md ├── Lab-27 │ ├── README.md │ ├── Question5.java │ ├── Question4.java │ └── Question6.java ├── Lab-28 │ ├── README.md │ ├── Question03.java │ ├── Question02.java │ ├── Question07.java │ ├── Question05.java │ ├── Question04.java │ ├── Question10.java │ ├── Question09.java │ ├── Question08.java │ └── Question11.java ├── Lab-29 │ ├── README.md │ ├── Question03.java │ ├── Question10.java │ ├── Question11.java │ ├── Question04.java │ ├── Question02.java │ ├── Question07.java │ ├── Question08.java │ ├── Question14.java │ ├── Question05.java │ └── Question13.java ├── Lab-30 │ ├── README.md │ ├── Question3.java │ ├── Question4.java │ └── Question5.java ├── Lab-31 │ ├── readme.md │ ├── Question26.java │ ├── Question05.java │ ├── Question06.java │ ├── Question04.java │ ├── Question12.java │ ├── Question18.java │ ├── Question09.java │ ├── Question07.java │ ├── Question21.java │ ├── Question14.java │ ├── Question16.java │ ├── Question17.java │ ├── Question08.java │ ├── Question20.java │ ├── Question01.java │ ├── Question10.java │ ├── Question24.java │ ├── Question02.java │ ├── Question22.java │ ├── Question03.java │ ├── Question19.java │ ├── Question15.java │ └── Question11.java ├── Lab-32 │ ├── readme.md │ ├── Question6.java │ └── Question2.java ├── Lab-33 │ └── readme.md ├── Lab-34 │ └── readme.md ├── Lab-35 │ └── readme.md ├── Lab-36 │ └── readme.md ├── Lab-37 │ ├── readme.md │ └── Question6.java ├── Lab-38 │ └── readme.md ├── Lab-39 │ └── readme.md ├── Lab-40 │ └── readme.md ├── Lab-41 │ └── readme.md ├── Lab-42 │ └── readme.md ├── Lab-43 │ ├── readme.md │ ├── Question1.java │ └── Question2.java ├── Lab-44 │ ├── readme.md │ ├── Question11.java │ ├── Question06.java │ ├── Question12.java │ ├── Question07.java │ ├── Question10.java │ └── Question08.java ├── Lab-45 │ ├── readme.md │ ├── Question3.java │ └── Question4.java ├── Lab-46 │ ├── readme.md │ ├── Question09.java │ └── Question11.java ├── Lab-47 │ ├── readme.md │ └── Question4.java ├── Lab-48 │ └── readme.md ├── Lab-49 │ └── readme.md ├── Lab-51 │ ├── README.md │ ├── Question4.java │ └── Question2.java ├── Lab-52 │ ├── README.md │ └── Question2.java ├── Lab-53 │ └── README.md ├── Lab-54 │ └── README.md ├── Lab-55 │ ├── README.md │ └── Question5.java ├── Lab-56 │ └── README.md ├── Lab-57 │ ├── README.md │ ├── Question07.java │ └── Question18.java ├── Lab-58 │ ├── Readme.md │ ├── Question19.java │ └── Question18.java ├── Lab-59 │ ├── Readme.md │ └── Question09.java ├── Lab-22 │ ├── ReorderArray.java │ ├── SymmetricalArrayCheck.java │ ├── SequenceCheck.java │ ├── SequenceOfEvens.java │ ├── CheckSorroundedElement.java │ ├── CompareArrays.java │ ├── ElementCheckInEveryPair.java │ ├── MultiplesInArray.java │ ├── FindCenteredAverage.java │ ├── ReorderArray_q11090.jav │ ├── EitherOfSequence.java │ └── FindSumIgnoringSection.java ├── Lab-02 │ ├── Question6.java │ ├── Question3.java │ ├── Question4.java │ ├── Question5.java │ └── Question1.java ├── Lab-05 │ └── Question05.java ├── Lab-01 │ ├── Question2.java │ └── Question4.java ├── Lab-03 │ ├── Question06.java │ ├── Question07.java │ ├── Question04.java │ ├── Question08.java │ ├── Question10.java │ ├── Question11.java │ ├── Question09.java │ ├── Question02.java │ ├── Question12.java │ ├── Question05.java │ └── Question03.java ├── Lab-24 │ ├── Student11159.java │ ├── Student11143.java │ ├── Student11142.java │ ├── Student11160.java │ └── Student11161.java ├── Lab-04 │ ├── Question01.java │ ├── Question02.java │ ├── Question03.java │ ├── Question04.java │ ├── Question05.java │ ├── Question06.java │ ├── Question07.java │ ├── Question08.java │ ├── Question09.java │ ├── Question11.java │ ├── Question13.java │ ├── Question14.java │ ├── Question12.java │ ├── Question17.java │ ├── Question18.java │ ├── Question16.java │ ├── Question20.java │ ├── Question10.java │ └── Question15.java ├── Lab-23 │ ├── Class Fundamental │ │ ├── Student.java │ │ ├── Student11155.java │ │ ├── Student11217.java │ │ └── 1.txt │ ├── 3.txt │ ├── 4.txt │ ├── 2.txt │ └── 1.txt ├── Lab-08 │ ├── Question02.java │ ├── Question06.java │ ├── Question10.java │ └── Question03.java ├── Lab-07 │ ├── Question09.java │ ├── Question12.java │ └── Question04.java ├── Lab-06 │ ├── Question09.java │ ├── Question11.java │ ├── Question05.java │ ├── Question10.java │ └── Question04.java ├── Lab-19 │ ├── IndexFinder.java │ ├── MountainNamePrinter.java │ ├── ArrayElementCounter.java │ ├── RiverNamePrinter.java │ ├── RiverNameFinder.java │ ├── IndexFinder2.java │ ├── ArrayElementCounter2.java │ ├── CityNameFinder.java │ └── ArrayReverser.java ├── Lab-21 │ ├── SwapFirstAndLast.java │ ├── SequenceCount2.java │ ├── CompareArrays.java │ ├── ElementCheck3.java │ ├── FindAverage.java │ ├── ElementCount.java │ ├── SumOfElements.java │ ├── Sum of Elements.java │ ├── ElementCheck5.java │ ├── CountEvens.java │ ├── InitializeArray.java │ ├── ConcatenateArrays.java │ ├── ElementCheck2.java │ ├── SumOfArrays.java │ ├── FindMiddle.java │ ├── CheckAlternateNo.java │ ├── ElementCheck.java │ ├── CompareArrays1.java │ ├── FindDuplicate.java │ ├── SequenceCheck.java │ ├── ElementCheck1.java │ ├── SumOfSameNumbers.java │ ├── ReversePrint.java │ ├── CountOfTwoNumbers.java │ ├── ElementDiff.java │ ├── ElementCheck4.java │ ├── SequenceCheck1.java │ └── README.md ├── Lab-12 │ ├── Question3.java │ ├── Question5.java │ └── Question6.java ├── Lab-11 │ ├── Question5.java │ └── Question2.java ├── Lab-17 │ ├── Question09.java │ ├── Question08.java │ ├── Question06.java │ ├── Question04.java │ ├── Question02.java │ └── Question11.java ├── Lab-20 │ ├── Sorting - Bubble, Insertion and Selection │ │ ├── InsertionSorting.java │ │ ├── BubbleSorting.java │ │ ├── SelectionSortingLargestElement.java │ │ └── SelectionSortingSmallestElement.java │ ├── Searching - Linear,Binary │ │ ├── LinearSearch.java │ │ └── BinarySearch.java │ └── README.md ├── Lab-60 │ └── Question4.java ├── Lab-10 │ └── Question3.java ├── Lab-62 │ ├── Writing Custom generic class.java │ └── Bounded Types.java ├── Lab-15 │ ├── Question02.java │ ├── Question15.java │ ├── Question12.java │ ├── Question03.java │ ├── Question08.java │ ├── Question11.java │ ├── Question07.java │ ├── Question05.java │ └── Question06.java ├── Lab-16 │ ├── Question6.java │ └── Question8.java ├── Lab-18 │ ├── Question3.java │ └── Question4.java ├── Lab-61 │ └── Question5.java ├── Lab-09 │ └── Question3.java └── Lab-14 │ └── Question5.java ├── Problem Solving using Python Lab ├── Unit-1 │ ├── add.py │ ├── tempConversion.py │ ├── swap.py │ └── timeCoversion.py ├── Unit-2 │ ├── factors.py │ ├── sumOfN.py │ ├── patterns.py │ ├── fibSeries.py │ ├── evenAndOdd.py │ ├── reverseNumber.py │ ├── primes.py │ ├── identyCharacter.py │ └── roots.py ├── Unit-3 │ ├── multiply.py │ ├── exponential.py │ └── largestNumber.py ├── Unit-5 │ ├── Exception_Example2.py │ ├── bubbleSort.py │ ├── linearSearch.py │ └── FileCounts.py └── Unit-4 │ ├── allEvenNumber.py │ ├── charCount.py │ ├── allEvenNumbers.py │ └── invertDictionary.py ├── Object Oriented Techniques using Java Lab ├── Lab-01 │ ├── FirstProgram.java │ ├── PrimitiveTypes.java │ └── TotalAndAvgMark.java ├── Lab-02 │ ├── balanceCheck.java │ ├── Factorial.java │ ├── FibonacciSeries.java │ └── NumberPalindrome.java ├── Lab-04 │ ├── Student.java │ └── SingleInheritance.java ├── Lab-07 │ ├── Example1.java │ ├── Division.java │ ├── AssertionExample.java │ ├── MultiCatchBlocks.java │ ├── LocaleExample.java │ ├── ThrowExample.java │ └── MyFinallyBlock.java ├── Lab-08 │ ├── Example.java │ ├── StringBuilderDemo.java │ └── StringBufferExample.java ├── README.md ├── Lab-12 (Searching & Sorting) │ ├── InsertionSorting.java │ ├── BubbleSorting.java │ ├── LinearSearch.java │ ├── SelectionSortingLargestElement.java │ ├── SelectionSortingSmallestElement.java │ ├── README.md │ └── BinarySearch.java ├── Lab-06 │ ├── CountOfTwoNumbers.java │ ├── MultiplicationOfMatrix.java │ └── MultiDimArrayPrinter.java ├── Lab-05 │ ├── Bike2.java │ └── TestOverloading1.java ├── Lab-03 │ ├── Main.java │ ├── StaticClassDemo.java │ └── StaticFieldDemo.java ├── Lab-11 │ ├── AddingElements.java │ └── Main.java └── Lab-10 │ ├── MyClass.java │ └── TestCustomAnnotation1.java ├── data structure lab using python ├── Array │ ├── linearArray.py │ ├── deleteElement.py │ ├── insertPosition.py │ └── SparseMatrix.py ├── Recursion │ ├── factorial.py │ ├── towerofhanoi.py │ ├── Mergesortrecursive.py │ ├── binarysearch.py │ ├── QuickSort.py │ └── mergesort.py ├── Searching │ ├── linearSearch.py │ └── binarySearch.py ├── Stack │ ├── stackImplement.py │ ├── convertInfixPostfix.py │ └── evalPostfix.py ├── LinkedList │ ├── traversaldoublelinkedlist.py │ ├── sortsinglelinkedlist.py │ ├── traversalsinglelinkedlist.py │ └── mergingdoublelinkedlist.py ├── Sorting │ ├── selectionSort.py │ ├── insertionSort.py │ └── bubblesort.py └── Queue │ └── QueueUsingArray.py ├── Competitive Coding - 2021 └── 5. Problems on Trees │ └── CTP24269.py ├── Design and Analysis of Algorithm Lab ├── 2. Divide & Conquer │ └── divideAndConquer.c ├── 1. Searching & Sorting │ ├── InsertionSort.c │ ├── linearSearch.c │ ├── binarySearch.c │ ├── countSort.c │ └── selection.c └── 3. Dynamic Programming & Backtracking │ ├── Knapsack.c │ └── largestSubSequence.c └── Operating System Lab └── Lab 6 └── VariablePartition.c /Competitive Coding Test/Top 500/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-25/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-26/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-27/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-28/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-29/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-30/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-31/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-32/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-33/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-34/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-35/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-36/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-37/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-38/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-39/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-40/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-41/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-42/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-43/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-44/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-45/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-46/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-47/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-48/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-49/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-51/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-52/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-53/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-54/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-55/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-56/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-57/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-58/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-59/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-22/ReorderArray.java: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-02/Question6.java: -------------------------------------------------------------------------------- 1 | package q11602; 2 | public class Test { 3 | 4 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-02/Question3.java: -------------------------------------------------------------------------------- 1 | package q10737; 2 | public class Student { 3 | 4 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-02/Question4.java: -------------------------------------------------------------------------------- 1 | package q10751; 2 | public class Student { 3 | 4 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-02/Question5.java: -------------------------------------------------------------------------------- 1 | package q10754; 2 | public class Student { 3 | 4 | } -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-1/add.py: -------------------------------------------------------------------------------- 1 | a=int(input("Enter First Number ")) 2 | b=int(input("Enter Second Number ")) 3 | c=a+b 4 | print("Sum =",c) 5 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-05/Question05.java: -------------------------------------------------------------------------------- 1 | Select all the correct answers 2 | Answer 3 | 4 | In Binary System, decimal 3 is represented as 0b11 -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-1/tempConversion.py: -------------------------------------------------------------------------------- 1 | a=float(input("Enter temperature in Celius ")) 2 | b=((9*a)/5)+32 3 | print("Temperature in Fahrenheit =",b) 4 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-01/Question2.java: -------------------------------------------------------------------------------- 1 | public class FirstProgram { 2 | public static void main(String[] args) { 3 | System.out.println("Hello Java"); 4 | } 5 | } -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-2/factors.py: -------------------------------------------------------------------------------- 1 | n=int(input("Enter number ")) 2 | print("Factors from 1 to",n,"are") 3 | for i in range(1,n+1): 4 | if n%i==0: 5 | print(i,end=' ') 6 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-01/FirstProgram.java: -------------------------------------------------------------------------------- 1 | public class FirstProgram { 2 | public static void main(String[] args) { 3 | System.out.println("Hello Java"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question06.java: -------------------------------------------------------------------------------- 1 | package q10802; 2 | public class Test { 3 | public static void main(String[] args) { 4 | System.out.println("Hello"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question07.java: -------------------------------------------------------------------------------- 1 | package q10802; 2 | public class Test { 3 | public static void main(String[] args) { 4 | System.out.println("Hello"); 5 | } 6 | } -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-3/multiply.py: -------------------------------------------------------------------------------- 1 | multiply=lambda a,b:a*b 2 | num1=int(input("Enter First Number ")) 3 | num2=int(input("Enter Second Number ")) 4 | print(multiply(num1,num2)) 5 | 6 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question04.java: -------------------------------------------------------------------------------- 1 | package q10800; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello"); 5 | } 6 | } -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-2/sumOfN.py: -------------------------------------------------------------------------------- 1 | term=int(input("Enter number of terms ")) 2 | fact=1 3 | sum=0 4 | for i in range(1,term+1): 5 | fact=fact*i 6 | sum=sum+fact 7 | print("Sum of series =",sum) 8 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-24/Student11159.java: -------------------------------------------------------------------------------- 1 | package q11159; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | } 8 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question08.java: -------------------------------------------------------------------------------- 1 | package q10804; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question10.java: -------------------------------------------------------------------------------- 1 | package q10806; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | 6 | }} -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question11.java: -------------------------------------------------------------------------------- 1 | package q10807; 2 | public class PrintHello { 3 | public static void main(String[] args){ 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question01.java: -------------------------------------------------------------------------------- 1 | package q10755; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question02.java: -------------------------------------------------------------------------------- 1 | package q10756; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question03.java: -------------------------------------------------------------------------------- 1 | package q10757; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question04.java: -------------------------------------------------------------------------------- 1 | package q10758; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question05.java: -------------------------------------------------------------------------------- 1 | package q10759; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question06.java: -------------------------------------------------------------------------------- 1 | package q10760; 2 | public class PrintHello { 3 | public static void main (String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question07.java: -------------------------------------------------------------------------------- 1 | package q10785; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question08.java: -------------------------------------------------------------------------------- 1 | package q10790; 2 | public class PrintHello { 3 | public static void main(String []args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question09.java: -------------------------------------------------------------------------------- 1 | package q10791; 2 | public class PrintHello { 3 | public static void main (String []args){ 4 | System.out.println("Hello, I am learning Java!"); 5 | } 6 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question09.java: -------------------------------------------------------------------------------- 1 | package q10805; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | System.out.println("Hello, I am learning Java!"); 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-23/Class Fundamental/Student.java: -------------------------------------------------------------------------------- 1 | package q11154; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | } 8 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-23/Class Fundamental/Student11155.java: -------------------------------------------------------------------------------- 1 | package q11155; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | } 8 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-23/Class Fundamental/Student11217.java: -------------------------------------------------------------------------------- 1 | package q11217; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | } 8 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-3/exponential.py: -------------------------------------------------------------------------------- 1 | def expo(base,exponent): 2 | return base**exponent 3 | num1=int(input("Enter Base Number ")) 4 | num2=int(input("Enter Exponent Number ")) 5 | print(num1,'^',num2,'=',expo(num1,num2)) 6 | -------------------------------------------------------------------------------- /Competitive Coding Test/Top 500/CTP5.py: -------------------------------------------------------------------------------- 1 | import sys 2 | score=int(sys.argv[1]) 3 | def isWinningScore(score): 4 | if score%7==0: 5 | return True 6 | return False 7 | print("true" if isWinningScore(score) else "false"); 8 | 9 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-08/Question02.java: -------------------------------------------------------------------------------- 1 | Select all the correct statements from the given options. 2 | 3 | Answer 4 | 5 | int x = 07_08_09; is a valid usage of Underscore 6 | int x = 0xA_B; 7 | int x = 1_____________0; -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-1/swap.py: -------------------------------------------------------------------------------- 1 | a=int(input("Enter First Number ")) 2 | b=int(input("Enter Second Number ")) 3 | print("Before swapping") 4 | print("a =",a,", b =",b) 5 | a,b=b,a 6 | print("After swapping") 7 | print("a =",a,", b =",b) 8 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-1/timeCoversion.py: -------------------------------------------------------------------------------- 1 | day=int(input("Enter number of days ")) 2 | hrs=int(input("Enter time in hours ")) 3 | mins=int(input("Enter time in minutes ")) 4 | s=day*24*3600+hrs*3600+mins*60 5 | print("Time in seconds =",s) 6 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-5/Exception_Example2.py: -------------------------------------------------------------------------------- 1 | a=int(input("Enter num1: ")) 2 | b=int(input("Enter num2: ")) 3 | try: 4 | print("Succesful Division, value of num1/num2 ",a/b) 5 | except ZeroDivisionError: 6 | print("Exception occured") 7 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question02.java: -------------------------------------------------------------------------------- 1 | package q10798; 2 | public class SpacesAndTabsDemo { 3 | public static void main(String[] args) { 4 | for (int i = 0; i < 5; i++) { 5 | System.out.println("i = " + i); 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-4/allEvenNumber.py: -------------------------------------------------------------------------------- 1 | mylist=input("Enter elements separated by a comma:").split(',') 2 | A=[int(i) for i in mylist] 3 | li=[] 4 | for i in A: 5 | if i%2==0: 6 | li.append(i) 7 | print("Even numbers in the list: ",li) 8 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-01/Question4.java: -------------------------------------------------------------------------------- 1 | package q10734; 2 | // A sample program 3 | public class FirstJavaProgram { 4 | public static void main(String[] args) { 5 | System.out.println("India got its independence in 1947"); 6 | } 7 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-23/3.txt: -------------------------------------------------------------------------------- 1 | [Right] 1.A class is a combination of data members and member functions. 2 | [Right] 2.An object is an instance of a class. 3 | [Right] 3.Data in an object captures the characteristics (or attributes) of that object. 4 | -------------------------------------------------------------------------------- /data structure lab using python/Array/linearArray.py: -------------------------------------------------------------------------------- 1 | arr=[] 2 | count = int(input("Enter how many elements you want:")) 3 | print("Enter numbers in array: ") 4 | for i in range(0,count): 5 | value = int(input("num :")) 6 | arr.append(value) 7 | print("ARRAY: ",arr) 8 | 9 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-2/patterns.py: -------------------------------------------------------------------------------- 1 | n=int(input("Enter n: ")) 2 | space=n-2 3 | star=1 4 | for i in range(1,n): 5 | for j in range(space): 6 | print(' ',end=' ') 7 | for k in range(star): 8 | print('*',end=' ') 9 | space-=1 10 | star+=2 11 | print() 12 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-2/fibSeries.py: -------------------------------------------------------------------------------- 1 | n=int(input("Enter number of terms ")) 2 | t1,t2=-1,1 3 | sumt=0 4 | for i in range(1,n+1): 5 | nextterm=t1+t2 6 | sumt=sumt+nextterm 7 | t1=t2 8 | t2=nextterm 9 | print("Sum of Fibonacci series upto ",n,"th terms",sumt) 10 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-4/charCount.py: -------------------------------------------------------------------------------- 1 | str1=input("Please enter sentence: ") 2 | mylist=[] 3 | for i in str1: 4 | if i not in mylist: 5 | mylist.append(i) 6 | mylist.sort() 7 | for j in mylist: 8 | print("'"+str(j)+"'",str1.count(j),sep="\t") 9 | print(mylist) 10 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-2/evenAndOdd.py: -------------------------------------------------------------------------------- 1 | terms=int(input("Enter number of terms ")) 2 | evensum=0 3 | oddsum=0 4 | for i in range(0,terms+1): 5 | if i%2==0: 6 | evensum=evensum+i 7 | else: 8 | oddsum=oddsum+i 9 | print("EVEN =",evensum) 10 | print("ODD =",oddsum) 11 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-07/Question09.java: -------------------------------------------------------------------------------- 1 | Select all the correct statements. 2 | 3 | 4 | Answer 5 | 6 | 7 | double d = 7.; is a valid statement 8 | double d = .7; is a valid statement 9 | double d = 7; is a valid statement 10 | double d = 1e1; is a valid statement -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-23/4.txt: -------------------------------------------------------------------------------- 1 | [right] 1.Abstraction is representing only essential things without knowing the background details. 2 | 2.A class contains only member functions to secure the data. 3 | [Right] 3.Encapsulation is combining both data and functions. 4 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question12.java: -------------------------------------------------------------------------------- 1 | package q10808; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | String text1 = "He"; 5 | String text2 = "llo"; 6 | String text3 = text1 + text2; 7 | System.out.println("text3 = " + text3); 8 | } 9 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question11.java: -------------------------------------------------------------------------------- 1 | package q10793; 2 | public class CommandLineArgumentDemo { 3 | public static void main(String[] args) { 4 | //Write the code fragment in the below println( ) method to print only the second argument 5 | System.out.println( args[1] ); 6 | } 7 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question13.java: -------------------------------------------------------------------------------- 1 | package q10795; 2 | public class CommandLineArgumentDemo { 3 | public static void main(String[] args) { 4 | //Write the code fragment in the below println( ) method to print only the first argument 5 | System.out.println( args[0] ); 6 | } 7 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question14.java: -------------------------------------------------------------------------------- 1 | package q10796; 2 | public class CommandLineArgumentDemo { 3 | public static void main(String[] args) { 4 | //Write the code fragment in the below println( ) method to print only the fifth argument 5 | System.out.println( args[4] ); 6 | } 7 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-23/2.txt: -------------------------------------------------------------------------------- 1 | [Right] 1.A class is a combination of data and its associated meaningful functions. 2 | [Right] 2.Object based programming implements information hiding and abstraction. 3 | 3.Object oriented programming does not implement inheritance and polymorphism. 4 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question12.java: -------------------------------------------------------------------------------- 1 | package q10794; 2 | public class CommandLineArgumentDemo { 3 | public static void main(String[] args) { 4 | //Write the code fragment in the below println( ) method to print only the fourth argument 5 | System.out.println( args[3] ); 6 | } 7 | } -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-02/balanceCheck.java: -------------------------------------------------------------------------------- 1 | package q10850; 2 | public class BalanceCheck 3 | { 4 | public void checkBalance(double balance) 5 | { 6 | if (balance<1000) 7 | System.out.println("Balance is low"); 8 | else 9 | System.out.println("Sufficient balance"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-06/Question09.java: -------------------------------------------------------------------------------- 1 | package q10774; 2 | public class ShortDemo { 3 | public static void main(String[] args) { 4 | short mangos = 3; 5 | short bananas = 4; 6 | short fruits =(short) (mangos + bananas); 7 | System.out.println("fruits = " + fruits);// should print 7 8 | } 9 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-19/IndexFinder.java: -------------------------------------------------------------------------------- 1 | package q10940; 2 | public class IndexFinder { 3 | public void printIndex(int[] intArr, int element) { 4 | for (int i = 0; i < intArr.length; i++) { 5 | if (intArr[i] == element) { 6 | System.out.println(i); 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-2/reverseNumber.py: -------------------------------------------------------------------------------- 1 | n=int(input("Enter number ")) 2 | temp=n 3 | reverse=0 4 | while n>0: 5 | reverse=reverse*10+n%10 6 | n=n//10 7 | print("Reverse number =",reverse) 8 | if temp==reverse: 9 | print(temp,"is in palindrome.") 10 | else: 11 | print(temp,"is not in palindrome.") 12 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question17.java: -------------------------------------------------------------------------------- 1 | Find the error in the given code and correct it. 2 | 3 | Note: Please don't change the package name.' 4 | 5 | 6 | package q10763; 7 | public class PrintHello { 8 | public static void main(String[] args) { 9 | System.out.println("Hello"); 10 | } 11 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-19/MountainNamePrinter.java: -------------------------------------------------------------------------------- 1 | package q10937; 2 | public class MountainNamePrinter{ 3 | public static void main(String[] args){ 4 | String[] arr={"Nanda Devi","Kamet","K12","Dunagiri"}; 5 | for(String mountain : arr){ 6 | System.out.println(mountain); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question18.java: -------------------------------------------------------------------------------- 1 | Identify the error in the given code and correct it. 2 | 3 | Note: Please don't change the package name.' 4 | 5 | 6 | package q10764; 7 | public class PrintHello { 8 | public static void main(String[] args) { 9 | System.out.println("Hello"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /data structure lab using python/Recursion/factorial.py: -------------------------------------------------------------------------------- 1 | #factorial using tail recursion 2 | def factorial(num): 3 | if num==0: 4 | return 1 #base_case 5 | else: 6 | return num*factorial(num-1) #recursive_call 7 | value=int(input("Enter a number: ")) 8 | fact=factorial(value) 9 | print("The factorial of",value,"is",fact) 10 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/SwapFirstAndLast.java: -------------------------------------------------------------------------------- 1 | package q11058; 2 | public class SwapFirstAndLast{ 3 | public void swap(int[] arr){ 4 | int temp=arr[0]; 5 | arr[0]=arr[arr.length-1]; 6 | arr[arr.length-1]=temp; 7 | for(int i=0;iA[j+1]: 5 | A[j],A[j+1]=A[j+1],A[j] 6 | mylist=input("Enter the list of numbers: ").split() 7 | A=[int(i) for i in mylist] 8 | length=len(A) 9 | bubbleSort(A) 10 | print("Sorted list:",A) 11 | -------------------------------------------------------------------------------- /data structure lab using python/Array/deleteElement.py: -------------------------------------------------------------------------------- 1 | a=int(input("Enter how many elements you want:")) 2 | print("Enter numbers in array:") 3 | arr=[] 4 | for i in range(0,a): 5 | b=int(input("num:")) 6 | arr.append(b) 7 | print("ARRAY:",arr) 8 | c=int(input("Enter position you want to delete element:")) 9 | arr.pop(c) 10 | print(arr) 11 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-19/ArrayElementCounter.java: -------------------------------------------------------------------------------- 1 | package q10942; 2 | public class ArrayElementCounter { 3 | public int countElement(int[] arr, int element) { 4 | int count = 0; 5 | for (int i = 0; i < arr.length; i++) { 6 | if (arr[i] == element) { 7 | count++; 8 | } 9 | } 10 | return count; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/SequenceCount2.java: -------------------------------------------------------------------------------- 1 | package q11064; 2 | 3 | public class SequenceCount { 4 | public int sequenceCount(int[] arr) { 5 | int count=0,i=0; 6 | for(i=0;ib and a>c: 3 | return a 4 | elif b>c: 5 | return b 6 | else: 7 | return c 8 | num1=int(input("Enter First Number ")) 9 | num2=int(input("Enter Second Number ")) 10 | num3=int(input("Enter Third number ")) 11 | print("Largest number =",largest(num1,num2,num3)) 12 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-19/RiverNamePrinter.java: -------------------------------------------------------------------------------- 1 | package q10936; 2 | public class RiverNamePrinter { 3 | public static void main(String[] args) { 4 | String[] namesArr = { "Ganga", "Yamuna", "Godavari", "Krishna", "Narmada", "Kaveri" }; 5 | for (String river : namesArr) { 6 | System.out.println(river); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-02/Factorial.java: -------------------------------------------------------------------------------- 1 | package q10886; 2 | class Factorial 3 | { 4 | public static void main(String args[]) 5 | { 6 | int n; 7 | int fact = 1; 8 | n = Integer.parseInt(args[0]); 9 | for(int i=1;i<=n;i++) 10 | { 11 | fact=fact*i; 12 | } 13 | System.out.println("Factorial of "+n+" is "+fact); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-4/allEvenNumbers.py: -------------------------------------------------------------------------------- 1 | a=int(input("How many numbers: ")) 2 | li=[] 3 | for i in range(a): 4 | item=int(input("Enter number ")) 5 | li.append(item) 6 | length=len(li) 7 | print("Maximum element in the list is :",max(li),'') 8 | print("Minimum element in the list is :",min(li)) 9 | print("Average = ",(sum(li)/length)) 10 | 11 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-19/RiverNameFinder.java: -------------------------------------------------------------------------------- 1 | package q10938; 2 | public class RiverNameFinder { 3 | public void findElement(int index) { 4 | String[] namesArr = { "Ganga", "Yamuna", "Godavari", "Krishna", "Narmada", "Kaveri" }; 5 | if (index >= 0 && index < namesArr.length) { 6 | System.out.println(namesArr[index]); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-23/Class Fundamental/1.txt: -------------------------------------------------------------------------------- 1 | 1. A class cannot contain another class. 2 | 2. A class need not contain the keyword class in its declaration. 3 | 3. int and Integer are predefined classes in Java. 4 | 4. In the statement: 5 | [Right] 5. Integer age = new Integer(25); 6 | age is an instance of class Integer. 7 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-31/Question26.java: -------------------------------------------------------------------------------- 1 | Given : 2 | public static void main(String[] args) { 3 | String str = "null"; 4 | if (str == null) { 5 | System.out.println("null"); 6 | } else (str.length() == 0) { 7 | System.out.println("zero"); 8 | } else { 9 | System.out.println("some"); 10 | } 11 | } 12 | 13 | 14 | Answer 15 | 16 | Compilation fails. -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-02/FibonacciSeries.java: -------------------------------------------------------------------------------- 1 | package q10896; 2 | class FibonacciSeries 3 | { 4 | public static void main(String args[]) 5 | { 6 | int n,a=0,b=1,s=a+b; 7 | n=Integer.parseInt(args[0]); 8 | System.out.print(a); 9 | while(s<=n) 10 | { 11 | System.out.print(" "+s); 12 | s=a+b; 13 | a=b; 14 | b=s; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-03/Question05.java: -------------------------------------------------------------------------------- 1 | package q10801; 2 | public class PrintHello { 3 | public static void main(String[] args) { 4 | String text1 = "He"; 5 | String text2 = "llo"; 6 | String text3 = text1 + text2; 7 | String text4 = ", I am learning Java"; 8 | String text5 = text3 + text4; 9 | System.out.println("text5 = " + text5); 10 | } 11 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-24/Student11143.java: -------------------------------------------------------------------------------- 1 | package q11143; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | public Student(String id, String name, int age, char gender) { 8 | this.id = id; 9 | this.name = name; 10 | this.age = age; 11 | this.gender = gender; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-45/Question3.java: -------------------------------------------------------------------------------- 1 | Select all the correct statements for the below code: 2 | public class Demo { 3 | public static void main(String[] args) { 4 | System.out.print("Up "); 5 | System.out.print("up"); 6 | System.out.print(" and away!"); 7 | } 8 | } 9 | 10 | 11 | 12 | Answers 13 | 14 | The output will be as given below: 15 | Up up and away! -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-24/Student11142.java: -------------------------------------------------------------------------------- 1 | package q11142; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | 8 | public Student(String id, String name, int age, char gender) { 9 | this.id = id; 10 | this.name = name; 11 | this.age = age; 12 | this.gender = gender; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-24/Student11160.java: -------------------------------------------------------------------------------- 1 | package q11160; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | 8 | public Student(String id, String name, int age, char gender) { 9 | this.id = id; 10 | this.name = name; 11 | this.age = age; 12 | this.gender = gender; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-24/Student11161.java: -------------------------------------------------------------------------------- 1 | package q11161; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | 8 | public Student(String id, String name, int age, char gender) { 9 | this.id = id; 10 | this.name = name; 11 | this.age = age; 12 | this.gender = gender; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-44/Question11.java: -------------------------------------------------------------------------------- 1 | public class StringBuilderDemo { 2 | public static void main(String args[]) { 3 | String s = "Hello"; 4 | s.concat("World"); 5 | System.out.println(s); 6 | } 7 | } 8 | What will be the output for the above program. Choose the correct option form the below. 9 | 10 | 11 | 12 | Answer 13 | 14 | 15 | Hello -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-51/Question4.java: -------------------------------------------------------------------------------- 1 | Read the code below: 2 | void waitForSignal() throws InterruptedException { 3 | Object obj = new Object(); 4 | synchronized (Thread.currentThread()) { 5 | obj.wait(); 6 | obj.notify(); 7 | } 8 | } 9 | Which statement is true? 10 | 11 | 12 | Answer 13 | 14 | The code throws IllegalMonitorStateException. -------------------------------------------------------------------------------- /Competitive Coding Test/Top 500/CTP1651.py: -------------------------------------------------------------------------------- 1 | import sys 2 | k=int(sys.argv[1]) 3 | n=int(sys.argv[2]) 4 | c=[int(x) for x in sys.argv[3].split(',')] 5 | def maximumPoints(k,n,c): 6 | c.sort() 7 | s=0 8 | co=0 9 | for i in c: 10 | if s+i<=k: 11 | s+=i 12 | co+=1 13 | else: 14 | break 15 | return co 16 | print( maximumPoints(k,n,c)) 17 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-43/Question1.java: -------------------------------------------------------------------------------- 1 | In Java, when we do not want a class to ever have subclasses, we declare that class as final. 2 | 3 | In Java we have many final classes. For example, like the String and all the wrapper classes like Integer, Float etc. 4 | 5 | 6 | Answer 7 | 8 | We declare a class as final, when we do not want someone to change its implementation by subclassing -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-44/Question06.java: -------------------------------------------------------------------------------- 1 | Given 2 | public class Main { 3 | public static void main(String args[]) { 4 | StringBuilder sb = new StringBuilder("Hi! Good Morning."); 5 | System.out.println(sb.length()); 6 | } 7 | } 8 | Choose the correct output for the above program form the below options. 9 | 10 | Answer 11 | 12 | 17 -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-46/Question09.java: -------------------------------------------------------------------------------- 1 | Given : 2 | import java.util.Date; 3 | import java.text.DateFormat; 4 | 5 | DateFormat df; 6 | Date date = new Date(); 7 | // insert code here 8 | String s = df.format(date); 9 | Which code fragment, inserted at // insert code here, allows the code to compile? 10 | 11 | 12 | Answer 13 | 14 | 15 | df = DateFormat.getInstance(); 16 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-04/Student.java: -------------------------------------------------------------------------------- 1 | package q11161; 2 | public class Student { 3 | private String id; 4 | private String name; 5 | private int age; 6 | private char gender; 7 | 8 | 9 | 10 | public Student(String id, String name, int age, char gender) { 11 | this.id = id; 12 | this.name = name; 13 | this.age = age; 14 | this.gender = gender; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-4/invertDictionary.py: -------------------------------------------------------------------------------- 1 | key=input("Enter elements separated by ,(comma) for keys: ").split(',') 2 | value=input("Enter elements separated by ,(comma) for values: ").split(',') 3 | zip_iterator=zip(key,value) 4 | my_dict=dict(zip_iterator) 5 | print("Dict : ",my_dict) 6 | inverted_dict={value: key for key,value in my_dict.items()} 7 | print("Inverted Dict :",inverted_dict) 8 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-2/primes.py: -------------------------------------------------------------------------------- 1 | term1=int(input("Enter first number ")) 2 | term2=int(input("Enter last number ")) 3 | print("Prime numbers from ",term1,"to",term2,"are") 4 | for i in range(term1,term2+1): 5 | if i==4: 6 | pass 7 | else: 8 | flag=0 9 | for j in range(2,i): 10 | if i%j==0: 11 | flag=1 12 | break 13 | if flag==0: 14 | print(i,end=' ') 15 | 16 | 17 | -------------------------------------------------------------------------------- /Competitive Coding - 2021/5. Problems on Trees/CTP24269.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Test Case 3: 3 | Command Line Arguments: 1 2 3 4 5 4 | Expected Output: 5 | 3 6 | ''' 7 | import sys 8 | 9 | treeStr = sys.argv[1] 10 | 11 | from math import floor,ceil,log 12 | 13 | def levelCount(treeStr): 14 | # Write code here 15 | ls = treeStr.split() 16 | n = len(ls) 17 | return ceil(log(n+1,2)) 18 | 19 | print(levelCount(treeStr)) 20 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question20.java: -------------------------------------------------------------------------------- 1 | In Java, a String is enclosed in double quotes and not in single quotes. We will learn more about Strings in the ensuing sections. Identify the error and correct the code. 2 | 3 | package q10766; 4 | public class PrintHello { 5 | public static void main(String[] args) { 6 | System.out.println("Hello, I am learning Java!"); 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-07/Example1.java: -------------------------------------------------------------------------------- 1 | public class Example1{ 2 | public static void main(String args[]){ 3 | try{ 4 | System.out.println("Starting of try block"); 5 | System.out.println(12/0); 6 | } 7 | catch(ArithmeticException e){ 8 | System.out.println("Catch Block"); 9 | System.out.println("MyException Occurred: This is My error Message"); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Problem Solving using Python Lab/Unit-5/linearSearch.py: -------------------------------------------------------------------------------- 1 | mylist=input("Enter the list of numbers: ").split() 2 | A=[int(i) for i in mylist] 3 | length=len(A) 4 | value=int(input("The number to search for: ")) 5 | loc=-1 6 | for i in range(length): 7 | if value==A[i]: 8 | loc=i+1 9 | break 10 | if loc==-1: 11 | print(value,"was not found.") 12 | else: 13 | print(value,"was found at index",str(loc-1)+'.') 14 | -------------------------------------------------------------------------------- /data structure lab using python/Array/insertPosition.py: -------------------------------------------------------------------------------- 1 | n=int(input("Enter how many elements you want:")) 2 | print("Enter numbers in array:") 3 | arr=[] 4 | for i in range(0,n): 5 | enter=int(input("num:")) 6 | arr.append(enter) 7 | print("ARRAY:",arr) 8 | p=int(input("Enter position you want to enter element:")) 9 | q=int(input("Enter the element you want to enter:")) 10 | arr.insert(p,q) 11 | print(arr) 12 | -------------------------------------------------------------------------------- /data structure lab using python/Searching/linearSearch.py: -------------------------------------------------------------------------------- 1 | mylist=input("Enter the list of numbers: ").split() 2 | A=[int(i) for i in mylist] 3 | length=len(A) 4 | value=int(input("The number to search for: ")) 5 | loc=-1 6 | for i in range(length): 7 | if value==A[i]: 8 | loc=i+1 9 | break 10 | if loc==-1: 11 | print(value,"was not found.") 12 | else: 13 | print(value,"was found at index",str(loc-1)+'.') 14 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-06/Question11.java: -------------------------------------------------------------------------------- 1 | package q10776; 2 | public class HolidaysCalculator { 3 | public static void main(String[] args) { 4 | short nationalHolidays =Short.parseShort(args[0]) ; 5 | short companyHolidays =Short.parseShort(args[1]) ; 6 | short totalHolidays = (short)(nationalHolidays + companyHolidays); 7 | System.out.println("totalHolidays = " + totalHolidays); 8 | } 9 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-27/Question5.java: -------------------------------------------------------------------------------- 1 | Fix the text in the main method using escape characters to produce the below output. 2 | 3 | There are double-quotes around "Red" 4 | 5 | package q11148; 6 | public class EscapeSequence { 7 | public static void main(String[] args) { 8 | String text1 = "There are double-quotes around \"Red\""; 9 | System.out.println(text1); 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-30/Question3.java: -------------------------------------------------------------------------------- 1 | package q11187; 2 | public class StringFormatting { 3 | public static void main(String[] args) { 4 | float dVar = 3.141f; 5 | 6 | System.out.printf("%f%n", dVar); 7 | System.out.printf("%.3f%n", dVar); 8 | System.out.printf("%.2f%n", dVar); 9 | System.out.printf("%08.4f%n", dVar); 10 | System.out.printf("%+08.4f%n", dVar); 11 | } 12 | } -------------------------------------------------------------------------------- /data structure lab using python/Stack/stackImplement.py: -------------------------------------------------------------------------------- 1 | stack=[] 2 | while True: 3 | data=input("Enter element, 'XXX' to end: ") 4 | if data=='XXX': 5 | break 6 | else: 7 | stack.append(data) 8 | print("Initial stack") 9 | print(stack) 10 | print("Elements poped from stack:") 11 | print(stack.pop()) 12 | print(stack.pop()) 13 | print(stack.pop()) 14 | print("Stack after elements are poped:") 15 | print(stack) 16 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-08/Example.java: -------------------------------------------------------------------------------- 1 | package q24212; 2 | public class Example 3 | { 4 | public static void main(String args[]) 5 | { 6 | String store="",Arg=args[0]; 7 | char ch; 8 | int l=Arg.length(); 9 | for(int i=0;i='A'&&ch<='Z') 13 | store+=ch; 14 | } 15 | System.out.println("The result is: "+store); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/CompareArrays.java: -------------------------------------------------------------------------------- 1 | package q11066; 2 | 3 | public class CompareArrays { 4 | /** 5 | * Find the length of the two arrays are equal or not 6 | * 7 | * 8 | * @return result 9 | */ 10 | 11 | 12 | 13 | public boolean compareArrays(int[] arr1, int[] arr2) { 14 | if(arr1.length==arr2.length) 15 | return true; 16 | else 17 | return false; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/ElementCheck3.java: -------------------------------------------------------------------------------- 1 | package q11055; 2 | 3 | public class ElementCheck { 4 | 5 | /** 6 | * Find first and last elements of the array are same are not 7 | * 8 | * @return true if both are same else return false 9 | */ 10 | public boolean elementFinder(int[] arr) { 11 | if(arr[0]==arr[arr.length-1]) 12 | return true; 13 | else 14 | return false; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/FindAverage.java: -------------------------------------------------------------------------------- 1 | package q11072; 2 | 3 | public class FindAverage { 4 | /** 5 | * Compute the average of elements in the given array 6 | * 7 | * 8 | * @return result 9 | */ 10 | 11 | public int findAverage(int[] arr) { 12 | int sum=0; 13 | for(int i=0;i=0){ 14 | sum+=arr[i]; 15 | } 16 | } 17 | return sum; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /data structure lab using python/Sorting/selectionSort.py: -------------------------------------------------------------------------------- 1 | #Python program to implement selection sort 2 | #it is similar to insertion sort 3 | mylist=input("Enter the list of numbers: ").split() 4 | A=[int(i) for i in mylist] 5 | length=len(A) 6 | for i in range(length-1): 7 | min=i 8 | for j in range(i+1,length): 9 | if A[min]>A[j]: 10 | min=j 11 | if i!=min: 12 | A[i],A[min]=A[min],A[i] 13 | strList=[str(i) for i in A] 14 | print(strList) 15 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-32/Question6.java: -------------------------------------------------------------------------------- 1 | Given : 2 | public static void main(String[] args) { 3 | Integer i = new Integer(1) + new Integer(2); 4 | switch(i) { 5 | case 3: 6 | System.out.println("three"); 7 | break; 8 | default: 9 | System.out.println("other"); 10 | break; 11 | } 12 | } 13 | What is the result? 14 | 15 | three 16 | 17 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-19/IndexFinder2.java: -------------------------------------------------------------------------------- 1 | package q10941; 2 | 3 | public class IndexFinder { 4 | /** 5 | * Find the first index match of the element in the array 6 | * 7 | * 8 | * @return index 9 | */ 10 | 11 | public int printIndex(int[] intArr, int element) { 12 | int i; 13 | for(i=0; i<=intArr.length; i++){ 14 | if(intArr[i]==element){ 15 | break; 16 | } 17 | } 18 | return i; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-11/Question5.java: -------------------------------------------------------------------------------- 1 | Understanding the usage of Conditional Operators 2 | 3 | package q10833; 4 | public class ConditionalOperatorsDemo { 5 | public static void main(String[] args) { 6 | boolean noWorkInOffice = true; 7 | boolean isTodaySunday = false; 8 | boolean canTakeLeave = true; 9 | if (isTodaySunday || (noWorkInOffice && canTakeLeave)) { 10 | System.out.println("I am fishing..."); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/ElementCheck5.java: -------------------------------------------------------------------------------- 1 | package q11068; 2 | public class ElementCheck { 3 | /** 4 | * Find if the arr contains only arg1 or arg2 elements 5 | * 6 | * 7 | * @return result 8 | */ 9 | 10 | public boolean checkElement(int[] arr, int arg1, int arg2) { 11 | for(int i=0;i-1)&&(arr[j]>key)){ 10 | arr[j+1]=arr[j]; 11 | j--; 12 | } 13 | arr[j+1]=key; 14 | } 15 | for(i=0;i0: 8 | print("Roots are real and distints.") 9 | print("x1 =",root1,", x2 =",root2) 10 | elif d==0: 11 | print("Roots are real and equal.") 12 | print("x1 =",root1,", x2 =",root2) 13 | else: 14 | print("Roots are imaginary.") 15 | 16 | -------------------------------------------------------------------------------- /data structure lab using python/Sorting/insertionSort.py: -------------------------------------------------------------------------------- 1 | #Simple python program to implement Insertion Sort by Shivesh 2 | def insertionSort(A): 3 | for i in range(1,length): 4 | key = A[i] 5 | j = i-1 6 | while j>=0 and key < A[j]: 7 | A[j + 1] = A[j] 8 | j = j-1 9 | A[j+1] = key 10 | 11 | mylist=input("Enter the list of numbers: ").split() 12 | print(mylist) 13 | A=[int(i) for i in mylist] 14 | length=len(A) 15 | insertionSort(A) 16 | strList=[str(i) for i in A] 17 | print(strList) 18 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-20/Sorting - Bubble, Insertion and Selection/InsertionSorting.java: -------------------------------------------------------------------------------- 1 | package q11040; 2 | public class InsertionSorting{ 3 | public void insertionSort(int arr[]){ 4 | int n,j,i,key; 5 | n=arr.length; 6 | for(i=1;i-1)&&(arr[j]>key)){ 10 | arr[j+1]=arr[j]; 11 | j--; 12 | } 13 | arr[j+1]=key; 14 | } 15 | for(i=0;iarray[j+1]){ 9 | dup=array[j+1]; 10 | array[j+1]=array[j]; 11 | array[j]=dup; 12 | } 13 | } 14 | } 15 | for(i=0;iarray[j+1]){ 9 | dup=array[j+1]; 10 | array[j+1]=array[j]; 11 | array[j]=dup; 12 | } 13 | } 14 | } 15 | for(i=0;i=0;i--){ 8 | if(arr[i]==args1){ 9 | f1=i; 10 | break; 11 | } 12 | } 13 | for(i=len-1;i>=0;i--){ 14 | if(arr[i]==args2){ 15 | f2=i; 16 | break; 17 | } 18 | } 19 | if(f1>f2) 20 | return true; 21 | else 22 | return false; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-02/Question1.java: -------------------------------------------------------------------------------- 1 | Click on the below Live Demo button to learn the steps involved in writing and executing a Java program. 2 | 3 | 4 | 5 | After learning from the Live Demo, select all correct statements given below: 6 | 7 | Answer 8 | 9 | The Java compiler uses the Java source file and generates file with .class extension. 10 | The file with .class extension is called as Java class file. 11 | The Java class file contains the Java bytecode, which is executed by the Java Virtual Machine (JVM). -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/FindDuplicate.java: -------------------------------------------------------------------------------- 1 | package q11073; 2 | 3 | public class FindDuplicate { 4 | /** 5 | * Find the arg element occures in the arr more than once 6 | * 7 | * 8 | * @return result 9 | */ 10 | 11 | public boolean findDuplicate(int[] arr, int arg) { 12 | //Write your code here 13 | int count=0; 14 | for(int i=0;i1) 20 | return true; 21 | else 22 | return false; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-29/Question03.java: -------------------------------------------------------------------------------- 1 | Write a class StringIndexOf with a main method. The method receives one command line argument. Print the second occurrence of the string CA in the argument. 2 | 3 | For Example: 4 | Cmd Args : CALIFORNICA 5 | 9 6 | 7 | package q11173; 8 | 9 | 10 | public class StringIndexOf { 11 | 12 | public static void main(String[] args) { 13 | 14 | String str = args[0]; 15 | 16 | System.out.println(str.indexOf("CA",2)); 17 | 18 | 19 | 20 | 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /data structure lab using python/Sorting/bubblesort.py: -------------------------------------------------------------------------------- 1 | #It repeatedly swap the adjacent element if they are in wrong order ex -- 5,1,4,2,8 2 | #It will sort it repeatedly by comparing 3 | #here it is a simple program to implement bubble sort 4 | 5 | def bubbleSort(A): 6 | for i in range(length): 7 | for j in range(0,length-i-1): 8 | if A[j]>A[j+1]: 9 | A[j],A[j+1]=A[j+1],A[j] 10 | mylist=input("Enter the list of numbers: ").split() 11 | A=[int(i) for i in mylist] 12 | length=len(A) 13 | bubbleSort(A) 14 | print("Sorted list:",A) 15 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/SequenceCheck.java: -------------------------------------------------------------------------------- 1 | package q11059; 2 | 3 | public class SequenceCheck { 4 | /** 5 | * Find the given elements present consecutively in the array or not 6 | * 7 | * 8 | * @return result 9 | */ 10 | 11 | public boolean sequenceCheck(int[] arr) { 12 | int count=0; 13 | for(int i=0;i=0;i--){ 13 | ans+=s.charAt(i); 14 | } 15 | System.out.println(ans.trim()); 16 | } 17 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/ElementCheck1.java: -------------------------------------------------------------------------------- 1 | package q11054; 2 | 3 | public class ElementCheck { 4 | /** 5 | * Compute if the given elemetn is present in the array only one time 6 | * 7 | * 8 | * @return true if it is present else return false 9 | */ 10 | 11 | public boolean elementFinder(int[] arr, int element) { 12 | int count=0; 13 | for(int i=0;i=10){ 20 | return true; 21 | }else{ 22 | return false; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-22/CheckSorroundedElement.java: -------------------------------------------------------------------------------- 1 | package q11088; 2 | 3 | public class CheckSurroundedElement { 4 | /** 5 | * Find the elements in the array surrounded by left and right and not equal to the left and right elements 6 | * 7 | * 8 | * 9 | * @print the result 10 | */ 11 | 12 | public void checkElement(int[] arr) { 13 | //Write your code here 14 | for(int i=1;i=0;i--){ 7 | lar=i; 8 | for(j=i-1;j>=0;j--){ 9 | if(array[j]>array[lar]) 10 | lar=j; 11 | } 12 | dup=array[lar]; 13 | array[lar]=array[i]; 14 | array[i]=dup; 15 | } 16 | for(i=0;i=0:"Not valid"; 11 | System.out.println("value is "+value); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /data structure lab using python/Recursion/towerofhanoi.py: -------------------------------------------------------------------------------- 1 | #Implementation of Tower Of Hanoi\ 2 | def TowerOfHanoi(n,from_rod,to_rod,aux_rod): 3 | if n == 1: 4 | print("Move disk 1 from source",from_rod,"to destination",to_rod) 5 | return 6 | TowerOfHanoi(n-1,from_rod,aux_rod,to_rod) 7 | print("Move disk",n,"from source",from_rod,"to destination",to_rod) 8 | TowerOfHanoi(n-1,aux_rod,to_rod,from_rod) 9 | #Driver Code 10 | n = int(input(" enter no of disk")) 11 | TowerOfHanoi(n,'A','B','C') 12 | #A,C,B are the name of rods 13 | #This code is written by Shivesh Shivam 14 | -------------------------------------------------------------------------------- /data structure lab using python/Array/SparseMatrix.py: -------------------------------------------------------------------------------- 1 | print("Enter values for Matrix ") 2 | m = int(input("Number of rows, m = ")) 3 | n = int(input("Number of columns, n = ")) 4 | result=[] 5 | for i in range(1,m+1): 6 | temp=[] 7 | for j in range(1,n+1): 8 | print("Entry in row:",i,"column:",j) 9 | temp2=int(input()) 10 | temp.append(temp2) 11 | result.append(temp) 12 | print("Matrix =",result) 13 | print("Sparse Matrix: ") 14 | for i in range(len(result)): 15 | for j in range(len(result[i])): 16 | if result[i][j] !=0: 17 | print(i,j,result[i][j],"") 18 | 19 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-10/Question3.java: -------------------------------------------------------------------------------- 1 | package q10831; 2 | public class RelationalOperatorDemo { 3 | public static void main(String[] args) { 4 | int x = 3; 5 | int y = 4; 6 | if (x != y) { 7 | System.out.println("x != y : " + (x != y)); 8 | } 9 | if (x < y) { 10 | System.out.println("x < y : " + (x < y)); 11 | } 12 | x++;// incrementing x 13 | if (x == y) { 14 | System.out.println("x == y : " + (x == y)); 15 | } 16 | --y;// decrementing y 17 | if (x > y) { 18 | System.out.println("x > y : " + (x > y)); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-25/Question15.java: -------------------------------------------------------------------------------- 1 | The list of variables/references that are present in the method declaration are called parameters. 2 | 3 | When the method is invoked the actual values passed are called arguments. 4 | 5 | Select all the correct statements for the below code: 6 | public int sum(int num1, int num2) { // statement 1 7 | return num1 + num2; 8 | } 9 | 10 | int total = sum(2, 3); // statement 2 11 | 12 | 13 | Answers 14 | In statement 1, num1 and num2 are called parameters. 15 | In statement 2, values 2 and 3 are called arguments. 16 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-31/Question09.java: -------------------------------------------------------------------------------- 1 | Write a class ExtractTag with a main method. The method receives one command line argument in between tags like [ ], extract the argument between the tags and print the output. 2 | 3 | For Example: 4 | Cmd Args : [Independent] 5 | Independent 6 | 7 | 8 | package q11199; 9 | 10 | 11 | 12 | public class ExtractTag{ 13 | 14 | public static void main(String[] args) { 15 | 16 | String str=args[0].replace("[","").replace("]",""); 17 | 18 | System.out.println(str); 19 | 20 | 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-28/Question04.java: -------------------------------------------------------------------------------- 1 | Create a class TestStringMethods with a main method. The method receives one command line argument. Convert the argument to lowercase and print the output. 2 | 3 | For Example: 4 | Cmd Args : KRISHNA 5 | krishna 6 | 7 | 8 | package q11162; 9 | public class TestStringMethods { 10 | 11 | 12 | 13 | public static void main(String[] args) { 14 | 15 | 16 | 17 | String str = args[0]; 18 | 19 | 20 | 21 | System.out.println(str.toLowerCase()); 22 | 23 | 24 | 25 | 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-19/CityNameFinder.java: -------------------------------------------------------------------------------- 1 | package q10939; 2 | public class CityNameFinder { 3 | /** 4 | * Create an array which contains given names 5 | * 6 | * 7 | * @print the index element 8 | * 9 | */ 10 | 11 | public void findElement(int index) { 12 | //Write your code here 13 | String[] namesArr={"Mumbai","Delhi","Kolkata","Chennai","Hyderabad","Bangalore"}; 14 | if(index>0 && index=0;i--){ 7 | lar=i; 8 | for(j=i-1;j>=0;j--){ 9 | if(array[j]>array[lar]) 10 | lar=j; 11 | } 12 | dup=array[lar]; 13 | array[lar]=array[i]; 14 | array[i]=dup; 15 | } 16 | for(i=0;i-2 && arr1[i]-arr2[i]<2) 19 | count++; 20 | } 21 | return count; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Design and Analysis of Algorithm Lab/2. Divide & Conquer/divideAndConquer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void main(){ 4 | int arr[10],n,i,max,min; 5 | printf("Enter the total number of Elements : "); 6 | scanf("%d",&n); 7 | printf("Enter the numbers : "); 8 | for(i=0;imax){ 14 | max=arr[i]; 15 | } 16 | if(arr[i]=B[jj]: 13 | j=(jj+1)%len(A) 14 | aa=aa+A[jj]-B[jj] 15 | while aa+A[j]-B[j]>=0: 16 | aa+=A[j]-B[j] 17 | j=(j+1)%len(A) 18 | if(j==1): return jj 19 | return -1 20 | print( minimumStartingPoint(A, B)) 21 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-20/README.md: -------------------------------------------------------------------------------- 1 | **This lab has later been removed from codetantra - Object Oriendted Techniques using Java Lab. 2 | Hence I am adding it as Lab 12(Searching & Sorting). It might be lab 7 in OOTS Lab. 3 | As it was in our Lab 7 of OOTS** 4 | 5 | |Sr. No|Searching| 6 | | :----| :-------| 7 | |1|LinearSearch.java| 8 | |2|BinarySearch.java| 9 | 10 | 11 | |Sr. No|Sorting| 12 | | :----| :-------| 13 | |1|BubbleSort.java| 14 | |2|InsertionSort.java| 15 | |3|SelectionSortingLargestElement.java| 16 | |4|SelectionSortingSmallestElement.java| 17 | |5|MyMergeSort.java| 18 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-22/ElementCheckInEveryPair.java: -------------------------------------------------------------------------------- 1 | package q11082; 2 | 3 | public class ElementCheckInEveryPair { 4 | /** 5 | * Find every pair of array contains atleast one arg 6 | * 7 | * 8 | * 9 | * 10 | *@return result 11 | */ 12 | 13 | public boolean checkElement(int[] arr, int arg) { 14 | //Write your code here 15 | int count=0; 16 | for(int i=0;i a1 = new A<>("Ganga"); 5 | System.out.println("a1.getValue() = " + a1.getValue()); 6 | A a2 = new A<>(true); 7 | System.out.println("a2.getValue() = " + a2.getValue()); 8 | } 9 | } 10 | class A { 11 | private T t; 12 | public A(T t) { 13 | this.t = t; 14 | } 15 | public T getValue() { 16 | return t; 17 | } 18 | public void setValue(T t) { 19 | this.t = t; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-20/Sorting - Bubble, Insertion and Selection/SelectionSortingSmallestElement.java: -------------------------------------------------------------------------------- 1 | package q11042; 2 | public class SelectionSortingSmallestElement{ 3 | public void selectionSortSmallestEle(int[] array){ 4 | int len=array.length; 5 | int i,j,dup=0,small=0; 6 | for(i=0;i<=(len-1);i++){ 7 | small=i; 8 | for(j=i+1;j<=(len-1);j++){ 9 | if(array[j]counter){ 23 | return true; 24 | } 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-22/MultiplesInArray.java: -------------------------------------------------------------------------------- 1 | package q11091; 2 | public class MultiplesInArray{ 3 | public static void findMultiples(int[] arr, int m1, int m2){ 4 | int size=arr.length; 5 | for(int i=0;iarr[j+1]){ 9 | int t=arr[j]; 10 | arr[j]=arr[j+1]; 11 | arr[j+1]=t; 12 | } 13 | } 14 | } 15 | for(int i=1;i>= >>>= 3 | 4 | Usage: 5 | 6 | int x = 3, y = 4, z = 0; 7 | 8 | z += x; // is same as writing z = z + x; 9 | z -= y; // is same as writing z = z - y;Select all the valid statements from the below code. 10 | int x = 2, y = 4, z = 5, value1 = 0, value2 = 0, value3 = 0; 11 | 12 | value1 *= x; 13 | 14 | value2 = x += 2 * y; 15 | 16 | y *= z; 17 | 18 | value3 -= 1; 19 | 20 | 21 | 22 | Answer 23 | 24 | value1 = 0 25 | 26 | y *= z; results in y's value being changed to 20 27 | 28 | value3 = -1 -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-31/Question01.java: -------------------------------------------------------------------------------- 1 | Write a class Greeting with a main method. The method receives one command line argument and prints the output as shown below. 2 | 3 | For example: 4 | Cmd Args : Ram 5 | Hello Ram! 6 | Note: Make sure to use println and not print method. If you want to use printf, ensure to print a \n character at the end. 7 | 8 | 9 | 10 | package q11191; 11 | 12 | 13 | public class Greeting{ 14 | 15 | public static void main(String[] args) { 16 | 17 | String ans=args[0]; 18 | 19 | 20 | 21 | System.out.println("Hello "+ ans +"!"); 22 | 23 | 24 | 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-55/Question5.java: -------------------------------------------------------------------------------- 1 | public interface House { 2 | @Deprecated 3 | void open(); 4 | void openFrontDoor(); 5 | void openBackDoor() 6 | } 7 | public class MyHouse implements House { 8 | public void open() {} 9 | public void openFrontDoor() {} 10 | public void openBackDoor() {} 11 | } 12 | If you compile this program, the compiler produces a warning because open was deprecated in the interface. What can you do to get rid of that warning?. Choose the correct answer from the following. 13 | 14 | 15 | 16 | Answers 17 | 18 | Suppress the warning by using @SuppressWarnings("deprecation") -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-31/Question10.java: -------------------------------------------------------------------------------- 1 | Write a class AttachTag with a main mehod. The method receives two command line arguments make the second argument as a special tag and attach before and after the first argument and print the value. 2 | 3 | For example: 4 | Cmd Args : Delhi New 5 | [New]Delhi[/New] 6 | Note: Make sure to use println and not print method. 7 | 8 | package q11200; 9 | 10 | 11 | public class AttachTag{ 12 | 13 | public static void main(String[] args) { 14 | 15 | String str="["+args[1]+"]"+args[0]+"[/"+args[1]+"]"; 16 | 17 | System.out.println(str); 18 | 19 | 20 | } 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/ElementDiff.java: -------------------------------------------------------------------------------- 1 | package q11071; 2 | 3 | public class ElementDiff { 4 | /** 5 | * Compute the difference between large and small elements in the given arry 6 | * 7 | * 8 | * @return result 9 | */ 10 | 11 | public int findDiff(int[] arr) { 12 | int largest=arr[0]; 13 | int smallest=arr[0]; 14 | for(int i=1;iarr[i]){ 16 | largest=arr[i]; 17 | } 18 | } 19 | for(int i=1;inum){ 22 | result= false; 23 | } 24 | else{ 25 | return true; 26 | } 27 | } 28 | return result; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-29/Question08.java: -------------------------------------------------------------------------------- 1 | Write a class SubstringText with a main method. The method receives one command line argument. Print the substring of the argument that starts at index 5 and ends at index 12 (should include the character at index 12). 2 | 3 | Assumptions: 4 | The argument contains more than 12 characters 5 | For Example: 6 | Cmd Args : Merry-go-round 7 | -go-roun 8 | 9 | 10 | package q11178; 11 | 12 | 13 | public class SubstringText { 14 | 15 | public static void main(String[] args) { 16 | 17 | String str = args[0]; 18 | 19 | System.out.println(str.substring(5,13)); 20 | 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-06/Question05.java: -------------------------------------------------------------------------------- 1 | package q10771; 2 | public class CalculateDifference { 3 | public static void main(String[] args) { 4 | // In the below two lines write code to convert 5 | // the string value passed in args[0] and args[1] into int values using Integer.parseInt method 6 | // convert the value in args[0] to int and store in firstValue 7 | // convert the value in args[1] to int and store in secondValue 8 | int firstValue = Integer.parseInt(args[0]); 9 | int secondValue =Integer.parseInt(args[1]); 10 | System.out.println("The difference of args[0] and args[1] is : " + (firstValue - secondValue)); 11 | } 12 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-25/Question05.java: -------------------------------------------------------------------------------- 1 | Identify the errors and correct them. 2 | 3 | Hint: Press Submit to see the errors and note the spellings. 4 | 5 | package q11129; 6 | public class Student { 7 | private String id; 8 | private String name; 9 | private int age; 10 | private char gender; 11 | 12 | public Student(String id, String name, int age, char gender) { 13 | this.id = id; 14 | this.name = name; 15 | this.age = age; 16 | this.gender = gender; 17 | } 18 | 19 | public String toString() { 20 | return "Student [name = " + name + ", id = " + id + ", age = " + age + ", gender = " + gender + "]"; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-28/Question11.java: -------------------------------------------------------------------------------- 1 | Write a class StringCompare with a main the method. The method receives two command line arguments compare the first and second arguments using equals() method and also by using == operator and print the result. 2 | 3 | For example : 4 | Cmd Args : Ganga Ganga 5 | The result with equals : true 6 | The result with == : false 7 | 8 | 9 | package q11169; 10 | public class StringCompare { 11 | public static void main(String[] args) { 12 | System.out.println("The result with equals : " + args[0].equals(args[1])); 13 | System.out.println("The result with == : " + (args[0]==args[1])); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-03/StaticClassDemo.java: -------------------------------------------------------------------------------- 1 | package q11293; 2 | import java.util.Scanner; 3 | class StaticClassDemo{ 4 | int a,b; 5 | StaticClassDemo(int a,int b) 6 | { 7 | this.a=a; 8 | this.b=b; 9 | } 10 | public void getValues() 11 | { 12 | System.out.println("a1 = A [value = " + this.a+"]"); 13 | System.out.println("a2 = A [value = " + this.b+"]"); 14 | } 15 | public static void main(String args[]){ 16 | Scanner sc = new Scanner(System.in); 17 | System.out.print("Enter a number:"); 18 | int a = sc.nextInt(); 19 | int b = sc.nextInt(); 20 | StaticClassDemo s = new StaticClassDemo(a,b); 21 | s.getValues(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-05/TestOverloading1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class TestOverloading1{ 3 | public void add(int a,int b){ 4 | System.out.println("Addition of two numbers: "+(a+b)); 5 | } 6 | public void add(int a,int b,int c){ 7 | System.out.println("Addition of three numbers: "+(a+b+c)); 8 | } 9 | public static void main(String args[]){ 10 | int a,b,c; 11 | Scanner sc = new Scanner(System.in); 12 | System.out.print("Enter three numbers: "); 13 | a=sc.nextInt(); 14 | b=sc.nextInt(); 15 | c=sc.nextInt(); 16 | TestOverloading1 obj = new TestOverloading1(); 17 | obj.add(a,b); 18 | obj.add(a,b,c); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Design and Analysis of Algorithm Lab/1. Searching & Sorting/InsertionSort.c: -------------------------------------------------------------------------------- 1 | #include 2 | void insertion(int arr[],int n){ 3 | for(int i=1;i=0) && (arr[j]>key)){ 7 | arr[j+1]=arr[j]; 8 | j--; 9 | } 10 | arr[j+1]=key; 11 | } 12 | } 13 | int main(){ 14 | int n; 15 | printf("Enter size of the array: "); 16 | scanf("%d",&n); 17 | int arr[n]; 18 | printf("Enter %d elements in to the array: ",n); 19 | for(int i=0;i=low): 3 | mid=(high+low)//2 4 | if x==array[mid]: 5 | return mid 6 | elif xarray[mid]: 9 | return binarysearch(array,mid+1,high,x) 10 | else: 11 | return -1 12 | size=int(input("Enter no of elements")) 13 | array=[] 14 | print("enter elements") 15 | for i in range(size): 16 | array.append(int(input())) 17 | target=int(input(" Which element you want to search")) 18 | passing=binarysearch(array,0,size-1,target) 19 | if passing!=-1: 20 | print("The element is present at index ",passing) 21 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-08/Question06.java: -------------------------------------------------------------------------------- 1 | Understanding special characters 2 | 3 | Answer 4 | 5 | package q10812; 6 | public class SpecialCharacters { 7 | public static void main(String[] args) { 8 | char aChar = 'A'; 9 | char tabChar = '\t'; 10 | char digitChar = '7'; 11 | char newLineChar = '\n'; 12 | char spaceChar = ' '; 13 | char hyphenChar = '-'; 14 | char percentageChar = '%'; 15 | System.out.print(aChar); 16 | System.out.print(tabChar); 17 | System.out.print(digitChar); 18 | System.out.print(newLineChar); 19 | System.out.print(spaceChar); 20 | System.out.print(hyphenChar); 21 | System.out.print(percentageChar); 22 | } 23 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-57/Question07.java: -------------------------------------------------------------------------------- 1 | Write a program to understand how to retrive an element in an ArrayList using the method get. 2 | 3 | Create a class ListDemo with a main method and get the element at index 1. 4 | 5 | 6 | 7 | package q11958; 8 | import java.util.*; 9 | public class ListDemo { 10 | public static void main(String[] args) { 11 | List namesList = new ArrayList(); 12 | namesList.add("Mercury"); 13 | namesList.add("Venus"); 14 | namesList.add("Earth"); 15 | namesList.add("Mars"); 16 | System.out.println(namesList.get(1)); // write your logic here 17 | } 18 | } 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-15/Question02.java: -------------------------------------------------------------------------------- 1 | Create a class IsWorkingDay with a main method. The method receives one command line argument which is the name of the weekday. If the argument is equal to Sunday or Saturday the program should print Holiday, otherwise it should print Working Day. 2 | 3 | For Example: 4 | Cmd Args : Monday 5 | Working Day 6 | Note: Please don't change the package name. 7 | 8 | package q10845; 9 | class IsWorkingDay{ 10 | public static void main(String[] args){ 11 | if(args[0].equals("Sunday") || args[0].equals("Saturday")){ 12 | System.out.println("Holiday"); 13 | }else{ 14 | System.out.println("Working Day"); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/SequenceCheck1.java: -------------------------------------------------------------------------------- 1 | package q11060; 2 | 3 | public class SequenceCheck { 4 | public boolean sequenceCheck(int[] arr) { 5 | int size=arr.length; 6 | boolean sequenceCheck=false; 7 | int a=1; 8 | for(int i=0;i ch == searchChar).count(); 19 | 20 | System.out.println(count); 21 | 22 | } 23 | } 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /data structure lab using python/LinkedList/traversalsinglelinkedlist.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self,data): 3 | self.data=data 4 | self.next=None 5 | class LinkedList: 6 | def __init__(self): 7 | self.head = None 8 | def push(self,new_data): 9 | new_node=Node(new_data) 10 | new_node.next=self.head 11 | self.head = new_node 12 | def display(self): 13 | temp = self.head 14 | while(temp): 15 | print(temp.data) 16 | temp = temp.next 17 | llist = LinkedList() 18 | count=int(input("Enter how many elements would you like to add: ")) 19 | for i in range(count): 20 | data = int(input("Enter data elements: ")) 21 | llist.push(data) 22 | print("The linked list is: ") 23 | llist.display() 24 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-31/Question02.java: -------------------------------------------------------------------------------- 1 | Write a class PrefixCheck with a main method. The method receives one command line argument. If the argument starts with en print it as it is, else prepend en and print the output. 2 | 3 | These are examples for your understanding : 4 | Cmd Args : bye 5 | enbye 6 | Cmd Args : entertainment 7 | entertainment 8 | 9 | 10 | package q11192; 11 | 12 | 13 | public class PrefixCheck{ 14 | 15 | public static void main(String[] args) { 16 | 17 | String ans=args[0]; 18 | 19 | if(ans.startsWith("en")) System.out.println(ans); 20 | 21 | else System.out.println("en"+ ans); 22 | 23 | 24 | 25 | 26 | 27 | 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-31/Question22.java: -------------------------------------------------------------------------------- 1 | Write a class RemoveSuffix with a main method. The method receives one command line argument. If the argument has the same prefix and suffixes up to 3 characters, remove the suffix and print the argument. 2 | 3 | Example: 4 | Cmd Args : systemsys 5 | system 6 | 7 | 8 | package q11212; 9 | public class RemoveSuffix{ 10 | 11 | public static void main(String[] args){ 12 | 13 | int n=args[0].length(); 14 | 15 | if(args[0].substring(0,3).equals(args[0].substring(n-3))) 16 | 17 | System.out.println(args[0].substring(0,n-3)); 18 | 19 | else System.out.println(args[0]); 20 | 21 | 22 | 23 | 24 | } 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-01/TotalAndAvgMark.java: -------------------------------------------------------------------------------- 1 | package q10817; 2 | public class TotalAndAvgMarks { 3 | public static void main(String args[]) { 4 | String name = args[0]; 5 | float marks1 = Float.parseFloat(args[1]); 6 | float marks2 = Float.parseFloat(args[2]); 7 | float marks3 = Float.parseFloat(args[3]); 8 | float total = marks1+marks2+marks3; 9 | float avg = total/3; 10 | System.out.println("Name = " +name ); 11 | System.out.println("Marks1 = " +marks1 ); 12 | System.out.println("Marks2 = " +marks2 ); 13 | System.out.println("Marks3 = " +marks3 ); 14 | System.out.println("Total Marks = " +total ); 15 | System.out.println("Average Marks = " +avg ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-15/Question15.java: -------------------------------------------------------------------------------- 1 | Create a class FindMax with a public method findMax that takes three parameters arg1, arg2, and arg3 are of type int. The program should print the largest of the given numbers. 2 | 3 | For example: 4 | Cmd Args : 10 20 5 5 | 20 6 | Note: Please don't change the package name. 7 | 8 | package q10930; 9 | 10 | public class FindMax{ 11 | 12 | public void findMax(int a1, int a2, int a3){ 13 | 14 | if(a1>a2 && a1>a3){ 15 | 16 | System.out.println(a1); 17 | 18 | }else if(a2>a1 && a2>a3){ 19 | 20 | System.out.println(a2); 21 | 22 | }else{ 23 | 24 | System.out.println(a3); 25 | 26 | } 27 | 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-31/Question03.java: -------------------------------------------------------------------------------- 1 | Write a class ExpandAString with a main method. The program receives two command line arguments. The first argument is a string and the second argument is a number. Print the first argument as many number of times as the second argument. 2 | 3 | For Example: 4 | Cmd Args : Ganga 3 5 | GangaGangaGanga 6 | 7 | 8 | package q11193; 9 | public class ExpandAString { 10 | 11 | 12 | 13 | 14 | public static void main(String[] args) { 15 | 16 | String ans=args[0]; 17 | 18 | int n=Integer.parseInt(args[1]); 19 | 20 | System.out.println(args[0].repeat(n)); 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-11/Main.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class Test{ 3 | T obj; 4 | Test(T obj){ 5 | this.obj=obj; 6 | } 7 | public T getObject(){ 8 | return this.obj; 9 | } 10 | } 11 | class Main{ 12 | public static void main(String args[]){ 13 | Scanner sc = new Scanner(System.in); 14 | System.out.print("Enter a string: "); 15 | String str = sc.nextLine(); 16 | Test sObj=new Test(str); 17 | System.out.println("The string is: "+sObj.getObject()); 18 | System.out.print("Enter an integer: "); 19 | int a = sc.nextInt(); 20 | Test iObj = new Test(a); 21 | System.out.println("The integer is: "+iObj.getObject()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Design and Analysis of Algorithm Lab/1. Searching & Sorting/linearSearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | int recursive(int a[],int item,int p,int r){ 3 | if(r3)?"true":"false"; 23 | 24 | System.out.println(ans); 25 | 26 | 27 | 28 | } 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-17/Question06.java: -------------------------------------------------------------------------------- 1 | Write a class Factorial with a main method. The method takes one command line argument. Write a logic to find the factorial of a given argument and print the output. 2 | 3 | For example: 4 | Cmd Args : 5 5 | Factorial of 5 is 120 6 | 7 | 8 | Note: Please don't change the package name. 9 | 10 | package q10886; 11 | class Factorial{ 12 | 13 | public static void main(String[] args ){ 14 | 15 | int i,fact=1; 16 | 17 | int number=Integer.parseInt(args[0]); 18 | 19 | for(i=1;i<=number;i++){ 20 | 21 | fact=fact*i; 22 | 23 | } 24 | 25 | System.out.println("Factorial of "+number+" is "+fact); 26 | 27 | } 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-22/FindSumIgnoringSection.java: -------------------------------------------------------------------------------- 1 | package q11093; 2 | public class FindSumIgnoringSection { 3 | /** 4 | * Compute the sum of all the elements in the array ignoring the elements between two ignore1 and ignore2 elements 5 | * 6 | * 7 | * @return sum 8 | * 9 | */ 10 | public int findSum(int[] arr, int ignore1, int ignore2) { 11 | int sum=0,a=0,b=0; 12 | for(int i=0;i=a && i<=b){ 22 | continue; 23 | }else{ 24 | sum+=arr[i]; 25 | } 26 | } 27 | return sum; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /data structure lab using python/LinkedList/mergingdoublelinkedlist.py: -------------------------------------------------------------------------------- 1 | n=int(input("Enter number of elements for list1 ")) 2 | l1=[] 3 | for i in range(0,n): 4 | e=int(input("Enter Element ")) 5 | l1.append(e) 6 | print("Elements of List1: ") 7 | l1.reverse() 8 | for i in l1: 9 | print(i) 10 | n2=int(input("Enter number of elements for list2 ")) 11 | l2=[] 12 | for i in range(0,n2): 13 | e2=int(input("Enter Element ")) 14 | l2.append(e2) 15 | print("Elements of List2: ") 16 | l2.reverse() 17 | for i in l2: 18 | print(i) 19 | if len(l1)>len(l2): 20 | l=l2+l1 21 | else: 22 | l=l1+l2 23 | for i in range(0,len(l)): 24 | if l[3]==32: 25 | l.pop(3) 26 | l.insert(0,32) 27 | print("Final List:") 28 | for i in l: 29 | print(i) 30 | -------------------------------------------------------------------------------- /data structure lab using python/Recursion/QuickSort.py: -------------------------------------------------------------------------------- 1 | def partition(array,low,high): 2 | pivot=array[high] 3 | i=low-1 4 | for j in range(low,high): 5 | if array[j]<=pivot: 6 | i=i+1 7 | array[i],array[j]=array[j],array[i] 8 | array[i+1],array[high]=array[high],array[i+1] 9 | return i+1 10 | def quicksort(array,low,high): 11 | if(low 2 | #include 3 | int max(int a, int b){ 4 | return(a>b)?a:b; 5 | } 6 | int knapsack(int W,int v[],int w[],int n){ 7 | if(n==0||W==0) 8 | return 0; 9 | if(w[n-1]>W) 10 | return knapsack(W,v,w,n-1); 11 | else 12 | return max(v[n-1]+knapsack(W-w[n-1],v,w,n-1),knapsack(W,v,w,n-1)); 13 | } 14 | void main(){ 15 | int n,W; 16 | printf("Enter number of items:"); 17 | scanf("%d",&n); 18 | int v[n],w[n]; 19 | printf("Enter value and weight of items:"); 20 | for(int i=0;i=25 && f<=35) || (s>=25 && s<=35)){ 15 | 16 | System.out.println("Within range"); 17 | 18 | }else{ 19 | 20 | System.out.println("Out of range"); 21 | 22 | } 23 | 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-18/Question4.java: -------------------------------------------------------------------------------- 1 | The class MultiDimArrayPrinter prints a multidimensional array of integers. 2 | 3 | The code in the main method uses for loops with loop counters to iterate over the multidimensional array int2DArr and print the values. 4 | 5 | Understand and retype the code below: 6 | 7 | package q10947; 8 | public class MultiDimArrayPrinter { 9 | public static void main(String[] args) { 10 | int[][] int2DArr = { 11 | {1}, 12 | {2, 3}, 13 | {4, 5, 6}, 14 | {7, 8, 9, 10} 15 | }; 16 | for (int i = 0; i < int2DArr.length; i++) { 17 | for (int j = 0; j < int2DArr[i].length; j++) { 18 | System.out.print(int2DArr[i][j] + " "); 19 | } 20 | System.out.println(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-04/SingleInheritance.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class FirstClass{ 3 | Scanner sc = new Scanner(System.in); 4 | void first(){ 5 | System.out.print("Enter the first class string: "); 6 | String f = sc.nextLine(); 7 | System.out.println("First class string is: "+f); 8 | } 9 | } 10 | class SecondClass extends FirstClass{ 11 | Scanner x = new Scanner(System.in); 12 | void second(){ 13 | System.out.print("Enter the second class string: "); 14 | String s = x.nextLine(); 15 | System.out.println("Second class string is: "+s); 16 | } 17 | } 18 | class SingleInheritance{ 19 | public static void main(String args[]){ 20 | SecondClass call = new SecondClass(); 21 | call.first(); 22 | call.second(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-06/MultiDimArrayPrinter.java: -------------------------------------------------------------------------------- 1 | package q10946; 2 | import java.util.Scanner; 3 | public class MultiDimArrayPrinter { 4 | public static void main(String args[]){ 5 | Scanner sc = new Scanner(System.in); 6 | int J; 7 | System.out.print("Enter Number of rows: "); 8 | int m = sc.nextInt(); 9 | System.out.print("Enter Number of columns: "); 10 | int n = sc.nextInt(); 11 | int a[][] = new int[m][n]; 12 | for(int i=0;istore[mid]: 21 | low=mid+1 22 | elif value 2 | int binary(int arr[],int k, int low,int high){ 3 | if(low<=high){ 4 | int mid=(low+high)/2; 5 | if(arr[mid]==k) 6 | return mid; 7 | else if(arr[mid] countryCodesMap = new HashMap(); 10 | countryCodesMap.put("IN", "India"); 11 | countryCodesMap.put("CA", "Canada"); 12 | countryCodesMap.put("AG", "Argentina"); 13 | countryCodesMap.put("BR", "Brazil"); 14 | Set codesSet = countryCodesMap.keySet(); 15 | for (String code : codesSet) { 16 | String countryName = countryCodesMap.get(code); 17 | System.out.println(code + " is the code for : " + countryName); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Design and Analysis of Algorithm Lab/3. Dynamic Programming & Backtracking/largestSubSequence.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void lcs(char a[],char b[]){ 4 | int n=strlen(a); 5 | int m=strlen(b); 6 | int c[n+1][m+1]; 7 | for(int j=0;j<=m;j++){ 8 | c[0][j]=0; 9 | } 10 | for(int i=1;i<=n;i++){ 11 | c[i][0]=0; 12 | } 13 | for(int i=1;i<=n;i++){ 14 | for(int j=1;j<=m;j++) 15 | { 16 | if(a[i-1]==b[j-1]) 17 | c[i][j]=c[i-1][j-1]+1; 18 | else if(c[i-1][j]>=c[i][j-1]) 19 | c[i][j]=c[i-1][j]; 20 | else 21 | c[i][j]=c[i][j-1]; 22 | } 23 | } 24 | printf("Length of LCS is %d\n",c[n][m]); 25 | } 26 | void main(){ 27 | char a[50],b[50]; 28 | printf("Enter a string1: "); 29 | gets(a); 30 | printf("Enter a string2: "); 31 | gets(b); 32 | lcs(a,b); 33 | } 34 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-06/Question04.java: -------------------------------------------------------------------------------- 1 | package q10770; 2 | public class IntegerDemo { 3 | public static void main(String args[]) { 4 | int decimalOne = 1; 5 | System.out.println("decimalOne = " + decimalOne); 6 | int binaryThree = 0b11; 7 | System.out.println("binaryThree = " + binaryThree); 8 | int octalEight = 010; 9 | System.out.println("octalEight = " + octalEight); 10 | int hexTen = 0xA; 11 | System.out.println("hexTen = " + hexTen); 12 | int unicodeValueOfOne = '1'; 13 | System.out.println("unicodeValueOfOne = " + unicodeValueOfOne); 14 | int unicodeValueOfA = 'A'; 15 | System.out.println("unicodeValueOfA = " + unicodeValueOfA); 16 | int unicodeValueOfZ = 'Z'; 17 | System.out.println("unicodeValueOfZ = " + unicodeValueOfZ); 18 | } 19 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-15/Question03.java: -------------------------------------------------------------------------------- 1 | Create a class SameNumbers with a public method checkNumbers that takes two parameters firstNo and secondNo are of type int and returns true if firstNo and secondNo are equal. The return type of checkNumbers should be boolean. 2 | 3 | For example: 4 | Cmd Args : 10 10 5 | true 6 | Cmd Args : 2 3 7 | false 8 | Note: Please don't change the package name. 9 | 10 | package q10864; 11 | 12 | public class SameNumbers { 13 | /** 14 | * Check if the two numbers are equal or not 15 | * 16 | * 17 | * 18 | * @return result 19 | */ 20 | 21 | 22 | public boolean checkNumbers(int a, int b) { 23 | //Write your code here 24 | if(a==b){ 25 | return true; 26 | }else{ 27 | return false; 28 | } 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-11/Question2.java: -------------------------------------------------------------------------------- 1 | Understanding Unary Operators 2 | 3 | package q10829; 4 | public class UnaryOperatorsDemo { 5 | public static void main(String[] args) { 6 | int x = 16; 7 | System.out.println("+x = " + (+x)); 8 | System.out.println("-x = " + (-x)); 9 | System.out.println("x = " + x); 10 | System.out.println("++x = " + (++x)); 11 | System.out.println("x = " + x); 12 | System.out.println("x++ = " + (x++)); 13 | System.out.println("x = " + x); 14 | System.out.println("--x = " + (--x)); 15 | System.out.println("x = " + x); 16 | System.out.println("x-- = " + (x--)); 17 | System.out.println("x = " + x); 18 | boolean flag = false; 19 | System.out.println("flag = " + flag); 20 | System.out.println("!flag = " + (!flag)); 21 | } 22 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-32/Question2.java: -------------------------------------------------------------------------------- 1 | The Math class present in java.lang package contains many useful static methods. These static methods are also called as utility methods. 2 | 3 | Classes like Math that have only static methods are also called Utility classes. 4 | 5 | Note: Most of the methods in Math class use double as data type, so we will see fractional part in the results. 6 | 7 | See the retype the below code. 8 | 9 | 10 | package q11239; 11 | public class MathExamples { 12 | public static void main(String[] args) { 13 | double base = 4; 14 | double exponent = 3; 15 | System.out.println(base + " to the power " + exponent + " is : " + Math.pow(base, exponent)); 16 | System.out.println("Square root of " + base + " is : " + Math.sqrt(base)); 17 | } 18 | } -------------------------------------------------------------------------------- /Design and Analysis of Algorithm Lab/1. Searching & Sorting/countSort.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void countSort(int arr[],int n){ 4 | int k=arr[0]; 5 | for(int i=0;i=0;i--) 14 | output[--count[arr[i]]]=arr[i]; 15 | for(int i=0;i60){ 17 | 18 | System.out.println("Discount Price"); 19 | 20 | }else{ 21 | 22 | System.out.println("Full Price"); 23 | 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-52/Question2.java: -------------------------------------------------------------------------------- 1 | Read the following code and select all the correct outputs: 2 | public class MyRunnable implements Runnable { 3 | public void run() { 4 | System.out.println("In run() method "); 5 | throw new RuntimeException("some problem"); 6 | } 7 | 8 | public static void main(String[] args) { 9 | Thread t1 = new Thread(new MyRunnable()); 10 | t1.start(); 11 | System.out.println("End of main() method"); 12 | } 13 | } 14 | 15 | 16 | Answer 17 | 18 | In run() method 19 | End of main() method 20 | java.lang.RuntimeException: some problem 21 | 22 | 23 | In run() method 24 | java.lang.RuntimeException: some problem 25 | End of main() method 26 | 27 | 28 | End of main() method 29 | In run() method 30 | java.lang.RuntimeException: some problem -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-15/Question07.java: -------------------------------------------------------------------------------- 1 | Create a class PrintWorkingHour with a public method checkWorkingHour that takes one parameter hour of type int. 2 | 3 | If the hour is in between 9 and 17 (both inclusive) the program should print Working hour, otherwise it should print Non-working hour. 4 | 5 | For Example: 6 | Cmd Args : 14 7 | Working hour 8 | Note: Please don't change the package name. 9 | 10 | 11 | package q10922; 12 | 13 | public class PrintWorkingHour { 14 | 15 | public void checkWorkingHour(int hour) { 16 | 17 | //Nrite your code here 18 | 19 | if(hour>=9 && hour<=17){ 20 | 21 | System.out.println("Working hour"); 22 | 23 | }else{ 24 | 25 | System.out.println("Non-working hour"); 26 | 27 | } 28 | 29 | } 30 | 31 | 32 | 33 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-17/Question04.java: -------------------------------------------------------------------------------- 1 | Write a class PrintAlphabet with a main method. Write a logic to print all the English alphabets from A to Z. 2 | 3 | Hint: Use for loop to iterate over the characters from 'A' to 'Z'. 4 | 5 | You can declare and initialize a loop counter char i and initialize it to 'A' (eg: char i = 'A';). The condition can similarly be i <= 'Z';. 6 | And the update statement can be i++ then print the value of i. 7 | 8 | 9 | 10 | Note: Please don't change the package name' 11 | 12 | package q10884; 13 | class PrintAlphabet 14 | 15 | { 16 | 17 | public static void main(String args[]) 18 | 19 | { 20 | 21 | char ch; 22 | 23 | 24 | 25 | for( ch = 'A' ; ch <= 'Z' ; ch++ ) 26 | 27 | System.out.println(ch); 28 | 29 | } 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-07/LocaleExample.java: -------------------------------------------------------------------------------- 1 | //Implement the concept of Localization in JAVA programming language 2 | //Read locality name as input (es,fr..) 3 | package q123; 4 | import java.util.*; 5 | class LocaleExample{ 6 | public static void main(String args[]){ 7 | Scanner sc = new Scanner(System.in); 8 | System.out.println("Enter name"); 9 | String name = sc.next(); 10 | Locale locale = new Locale(name,name); 11 | System.out.println(locale.getDisplayCountry()); 12 | System.out.println(locale.getDisplayLanguage()); 13 | System.out.println(locale.getDisplayName()); 14 | System.out.println(locale.getISO3Country()); 15 | System.out.println(locale.getISO3Language()); 16 | System.out.println(locale.getLanguage()); 17 | System.out.println(locale.getCountry()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Operating System Lab/Lab 6/VariablePartition.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(){ 4 | int m=0,m1=0,m2=0,p,count=0,i; 5 | printf("enter the memory capacity:"); 6 | scanf("%d",&m); 7 | printf("enter the no of processes:"); 8 | scanf("%d",&p); 9 | for(i=0;i namesList = new ArrayList<>(); 6 | namesList.add("Ganga"); 7 | namesList.add("Godavari"); 8 | namesList.add("Krishna"); 9 | Set namesSet = new LinkedHashSet<>(); 10 | namesSet.add("Ganga"); 11 | namesSet.add("Godavari"); 12 | namesSet.add("Krishna"); 13 | namesSet.add("Yamuna"); 14 | namesSet.add("Narmada"); 15 | System.out.println("largerCollection : " + largerCollection(namesList, namesSet)); 16 | } 17 | public static T largerCollection(T collection1, T collection2) { 18 | return (collection1.size() > collection2.size())? collection1 : collection2; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-07/ThrowExample.java: -------------------------------------------------------------------------------- 1 | package q11335; 2 | public class ThrowExample { 3 | public static void main(String args[]) { 4 | System.out.println("Welcome to the Registration process!!"); 5 | try { 6 | checkEligibilty(Integer.parseInt(args[0]),Integer.parseInt(args[1])); // Fill the missing code 7 | System.out.println("Have a nice day"); 8 | } 9 | catch(Exception e) { // Fill the missing code 10 | System.out.println(e); // Fill the missing code 11 | } 12 | } 13 | static void checkEligibilty(int age, int weight) { 14 | if(age < 12 && weight < 40) { // Write the condition 15 | throw new ArithmeticException("Student is not eligible for registration"); // Fill the missing code 16 | } else { 17 | System.out.println("Student Entry is Valid!!"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-04/Question15.java: -------------------------------------------------------------------------------- 1 | The PrintHello class demonstrates printing text to the console. 2 | 3 | You will notice that the line, System.out.println("Hello, I am learning Java!"); is responsible for printing the text. 4 | 5 | This line is written inside the main method. 6 | Please note that in Java, String literals (i.e. text) must be enclosed in double quotes. 7 | In our case you will notice that the String literal Hello, I am learning Java! is enclosed in double quotes. 8 | 9 | Click on to understand basics of printing. 10 | 11 | See the code and retype the same code. 12 | 13 | Note: Please don't change the package name. 14 | 15 | package q10761; 16 | public class PrintHello { 17 | public static void main(String[] args) { 18 | System.out.println("Hello, I am learning Java!"); 19 | } 20 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-08/Question10.java: -------------------------------------------------------------------------------- 1 | A String is a sequence of zero or more characters enclosed in double-quotes. For example, 2 | String name = "Ganga"; 3 | The value "Ganga" is called the string literal. We cannot open a double-quote on one line and close the double-quote in another line, they both should be in the same line. 4 | 5 | We can embed escape characters (like \t, \n) also in a string literal. For example, 6 | String greetingText = "Hello Thames\nWelcome to London!"; 7 | The above line when printed would have "Hello Thames" in one line and "Welcome to London!" in the next line. 8 | 9 | We will learn about the String class in detail later. 10 | 11 | Select all correct statements. 12 | 13 | 14 | 15 | Answer 16 | 17 | 18 | String text = "Hello" 19 | + "World"; 20 | is a valid statement. -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-25/Question02.java: -------------------------------------------------------------------------------- 1 | toString() is a special method used to convert an object's state information into a human readable text. 2 | 3 | Note the spelling of toString() 4 | 5 | The toString() method does not take any parameters and will always return a String. 6 | 7 | See the code and retype the below code.' 8 | 9 | 10 | package q11126; 11 | public class Student { 12 | private String id; 13 | private String name; 14 | private int age; 15 | private char gender; 16 | 17 | public Student(String id, String name, int age, char gender) { 18 | this.id = id; 19 | this.name = name; 20 | this.age = age; 21 | this.gender = gender; 22 | } 23 | 24 | public String toString() { 25 | return "Student [id = " + id + ", name = " + name + ", age = " + age + ", gender = " + gender + "]"; 26 | } 27 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-29/Question14.java: -------------------------------------------------------------------------------- 1 | Create a class PalindromeOrNot with a main method. The method receives one command line argument. Check the given argument is palindrome or not. 2 | 3 | For example: 4 | Cmd Args : madam 5 | The given string madam is a palindrome 6 | Cmd Args : Godavari 7 | The given string Godavari is not a palindrome 8 | 9 | 10 | 11 | package q11184; 12 | 13 | 14 | public class PalindromeOrNot{ 15 | 16 | public static void main(String[] args) { 17 | 18 | String str = args[0]; 19 | 20 | String rev=new StringBuffer(str).reverse().toString(); 21 | 22 | if(str.equals(rev)) { 23 | System.out.println("The given string " + str + " is a palindrome"); 24 | } 25 | 26 | else { 27 | System.out.println("The given string " + str + " is not a palindrome"); 28 | 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-10/TestCustomAnnotation1.java: -------------------------------------------------------------------------------- 1 | //create, apply and access annotation 2 | //Create annotion having value 10 in class hello 3 | import java.lang.annotation.*; 4 | import java.lang.reflect.*; 5 | @Retention(RetentionPolicy.RUNTIME) 6 | @interface MyAnnotation{ 7 | int value(); 8 | } 9 | class Hello{ 10 | 11 | @MyAnnotation(value=10) 12 | public void sayHello(){ 13 | System.out.println("hello annotation"); 14 | } 15 | } 16 | //Create class and access the defined annotation 17 | class TestCustomAnnotation1{ 18 | public static void main(String args[])throws Exception{ 19 | Hello h=new Hello(); 20 | Method m=h.getClass().getMethod("sayHello"); 21 | MyAnnotation manno=m.getAnnotation(MyAnnotation.class); 22 | //Use manno as Object 23 | System.out.println("value is: "+manno.value()); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-57/Question18.java: -------------------------------------------------------------------------------- 1 | Fill the missing code in the below program to learn how to get elemetns stored in a ArrayList. 2 | 3 | Write a Java program with a class name ArrayListIterationDemo with a main method. The method takes inputs from the command line arguments. Print the element at the index 2 using get(int index) method. 4 | 5 | Sample Input and Output: 6 | Cmd Args : Welcome to Hyderabad 7 | Name at index 2 is : Hyderabad 8 | 9 | 10 | 11 | package q23676; 12 | import java.util.*; 13 | public class ArrayListIterationDemo { 14 | public static void main(String[] args) { 15 | List < String > nameList = new ArrayList < String > (); 16 | 17 | for (int i = 0; i namesMap = new TreeMap(); 15 | namesMap.put("Hy", "Hyderabad"); 16 | namesMap.put("Ban", "Bangalre"); 17 | namesMap.put("Ke","Kerala"); 18 | System.out.println(namesMap); 19 | 20 | // Find whether the given map contains the key Ban or not. 21 | System.out.println(namesMap.containsKey("Ban")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-21/README.md: -------------------------------------------------------------------------------- 1 | |S.No|Order Of Program| 2 | | :--| :--------------| 3 | |1|Sum Of Elements.java| 4 | |2|PeversePrint.java| 5 | |3|ElementCheck.java| 6 | |4|ElementCount.java| 7 | |5|ElementCheck2.java| 8 | |6|ElementCheck1.java| 9 | |7|ElementCheck3.java| 10 | |8|ElementCheck4.java| 11 | |9|SumOfElements.java| 12 | |10|SwapFirstAndLast.java| 13 | |11|SequenceCheck.java| 14 | |12|SequenceCheck1.java| 15 | |13|FindMiddle.java| 16 | |14|SequenceCount.java| 17 | |15|InitializeArray.java| 18 | |16|SequenceCount2.java| 19 | |17|SumOfArrays.java| 20 | |18|CompareArrays.java| 21 | |19|CompareArrays1.java| 22 | |20|ElementCheck5.java| 23 | |21|CountEvens.java| 24 | |22|ConcatenateArrays.java| 25 | |23|ElementDiff.java| 26 | |24|FindAverage.java| 27 | |25|FindDuplicate.java| 28 | |26|SumOfSameNumbers.java| 29 | |27|CountOfTwoBumbers.java| 30 | |28|CheckAlternateNo.java| 31 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-03/StaticFieldDemo.java: -------------------------------------------------------------------------------- 1 | package q11291; 2 | import java.util.Scanner; 3 | class StaticFieldDemo{ 4 | static int a; 5 | int b,c; 6 | StaticFieldDemo(int b,int c) 7 | { 8 | this.b=b; 9 | this.c=c; 10 | } 11 | public void getValues() 12 | { 13 | System.out.println("a1 = A [instanceField = " + this.b +","+" aStaticField = "+StaticFieldDemo.a + "]"); 14 | System.out.println("a2 = A [instanceField = " + this.c +","+" aStaticField = "+StaticFieldDemo.a + "]"); 15 | System.out.println("A"+"."+"aStaticField = "+StaticFieldDemo.a); 16 | } 17 | public static void main(String args[]){ 18 | Scanner sc = new Scanner(System.in); 19 | System.out.print("Enter a StaticField number"); 20 | a = sc.nextInt(); 21 | int b = sc.nextInt(); 22 | int c = sc.nextInt(); 23 | StaticFieldDemo s = new StaticFieldDemo(b,c); 24 | s.getValues(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-07/MyFinallyBlock.java: -------------------------------------------------------------------------------- 1 | package q11330; 2 | public class MyFinallyBlock { 3 | public static void main(String args[]){ 4 | int a = Integer.parseInt(args[0]); 5 | int b = Integer.parseInt(args[1]); 6 | Float c = Float.parseFloat(args[2]); 7 | Float d = Float.parseFloat(args[3]); 8 | try{ 9 | System.out.println("Result of integer values division : "+a/b); 10 | } 11 | catch(ArithmeticException e){ 12 | System.out.println("Inside the 1st catch block"); 13 | } 14 | finally{ 15 | System.out.println("Inside the 1st finally block"); 16 | } 17 | try{ 18 | System.out.println("Result of float values division : "+c/d); 19 | } 20 | catch(ArithmeticException e){ 21 | System.out.println("Inside of the 2nd catch block"); 22 | } 23 | finally{ 24 | System.out.println("Inside the 2nd finally block"); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Object Oriented Techniques using Java Lab/Lab-12 (Searching & Sorting)/BinarySearch.java: -------------------------------------------------------------------------------- 1 | package q11045; 2 | public class BinarySearch{ 3 | public void binarySearch(int[] arr,int key){ 4 | int first=0; 5 | int last=arr.length; 6 | int mid; 7 | for(int i=0;ilast) 32 | System.out.println("Search element "+key+" is not found"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-09/Question3.java: -------------------------------------------------------------------------------- 1 | In every programming language there are certain keywords. Below are the keywords in Java: 2 | abstract continue for new switch 3 | assert default if package synchronized 4 | boolean do goto private this 5 | break double implements protected throw 6 | byte else import public throws 7 | case enum instanceof return transient 8 | catch extends int short try 9 | char final interface static void 10 | class finally long strictfp volatile 11 | const float native super while 12 | These words have special meaning and usage. They cannot be used for naming variables, references or methods or classes. 13 | 14 | null is not a keyword in Java. 15 | if is a keyword -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-20/Searching - Linear,Binary/BinarySearch.java: -------------------------------------------------------------------------------- 1 | package q11045; 2 | public class BinarySearch{ 3 | public void binarySearch(int[] arr,int key){ 4 | int first=0; 5 | int last=arr.length; 6 | int mid; 7 | for(int i=0;ilast) 32 | System.out.println("Search element "+key+" is not found"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-58/Question18.java: -------------------------------------------------------------------------------- 1 | Create a class TreeMapDemo with a main method. The method takes inputs from the command line arguments and make first three chars of the input as a key and argument as a value add them to the TreeMap and print the result. 2 | 3 | Sample Input and Output: 4 | Cmd Args : Samos Dallas Bangalore 5 | Ban : Bangalore 6 | Dal : Dallas 7 | Sam : Samos 8 | 9 | 10 | import java.util.*; 11 | public class TreeMapDemo { 12 | public static void main(String[] args) { 13 | Map namesMap = new TreeMap(); 14 | // Write your code here 15 | for(int i=0;i nameSet = namesMap.keySet(); 18 | for (Object key : nameSet) { 19 | // Write your code here 20 | System.out.println(key+" : "+namesMap.get(key)); 21 | 22 | 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-59/Question09.java: -------------------------------------------------------------------------------- 1 | Write a program to understand how to remove an element in the Set using the remove method. Create a class SetDemo with a main method and insert the numbers from one to five and remove the elements two and three from the set and print the result. 2 | 3 | 4 | 5 | import java.util.*; 6 | public class SetDemo { 7 | public static void main(String[] args) { 8 | Set namesSet = new HashSet (); 9 | 10 | 11 | // write your code here 12 | namesSet.add("Five"); 13 | 14 | namesSet.add("One"); 15 | 16 | namesSet.add("Four"); 17 | 18 | namesSet.add("Two"); 19 | 20 | namesSet.add("Three"); 21 | 22 | 23 | 24 | 25 | 26 | System.out.println(namesSet); 27 | 28 | // write your code here 29 | namesSet.remove("Two"); 30 | namesSet.remove("Three"); 31 | 32 | System.out.println(namesSet); 33 | } 34 | } -------------------------------------------------------------------------------- /Design and Analysis of Algorithm Lab/1. Searching & Sorting/selection.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void selection(int arr[],int n){ 4 | 5 | for(int i=0;iarr[j]){ 12 | 13 | arr[i]=arr[i]^arr[j]; 14 | 15 | arr[j]=arr[i]^arr[j]; 16 | 17 | arr[i]=arr[i]^arr[j]; 18 | 19 | } 20 | 21 | } 22 | 23 | } 24 | 25 | } 26 | 27 | int main(){ 28 | 29 | int n; 30 | 31 | // scanf("%d",&n) 32 | 33 | printf("Enter size of the array : "); 34 | 35 | scanf("%d",&n); 36 | 37 | int arr[n]; 38 | 39 | printf("Enter the elements :"); 40 | 41 | for(int i=0;i-25 && diff<25){ 21 | 22 | System.out.println(diff+diff); 23 | 24 | } 25 | 26 | else{ 27 | 28 | System.out.println(diff); 29 | 30 | } 31 | 32 | } 33 | 34 | 35 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-07/Question12.java: -------------------------------------------------------------------------------- 1 | Java provides a class called BigDecimal for representing and computing decimal numbers with any required precision. 2 | 3 | BigDecimal is not a wrapper class of any primitive data type. It is a convenience class for handling large decimal numbers with arbitrary precision. The value to be represented by BigDecimal should be passed to one of the BigDecimal constructors. 4 | 5 | Retype the code below. 6 | 7 | You will notice an import statement at the beginning of the program to use BigDecimal class. We will learn about packages and import statements in other sections. 8 | 9 | Note: Please don't change the package name. 10 | 11 | 12 | package q10860; 13 | import java.math.BigDecimal; 14 | public class BigDecimalUsage { 15 | public static void main(String[] args) { 16 | BigDecimal x = new BigDecimal("3.14159265358"); 17 | System.out.print(x); 18 | } 19 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-43/Question2.java: -------------------------------------------------------------------------------- 1 | Select all the correct statements from the below code: 2 | public final class A { 3 | public void m1() { // statement 1 4 | ... 5 | } 6 | } 7 | public class B extends A { // statement 2 8 | } 9 | public class C { 10 | public void m2() { 11 | ... 12 | } 13 | } 14 | public class D extends C { 15 | public final void m2() { // statement 3 16 | final int value = 2; 17 | final int[] valueArr = {2, 3, 4}; 18 | final String text1 = "Cat on the wall"; 19 | String text2 = text1; // statement 4 20 | String text3 = "Dog in the pool"; 21 | text1 = text3; // statement 5 22 | valueArr[1] = value; // statement 6 23 | } 24 | } 25 | 26 | 27 | 28 | Answer 29 | 30 | In statement 2, will result in compilation error. Since class A is declared as final it cannot be extended by class B. 31 | 32 | Statement 5 will result in a compilation error. -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-07/Question04.java: -------------------------------------------------------------------------------- 1 | Create a class HolidaysCalculator with a main method. The method receives two command line arguments the first argument contains the count of national holidays declared in that country and the second argument contains a count of company specific holidays. Write a code to print the total number of holidays as the sum of both national and company holidays. 2 | 3 | For example: 4 | Cmd Args : 3 4 5 | totalHolidays = 7 6 | 7 | 8 | Note: Please don't change the package name. 9 | 10 | 11 | 12 | Answer 13 | 14 | package q10780; 15 | public class HolidaysCalculator { 16 | public static void main(String[] args) { 17 | byte nationalHolidays = Byte.parseByte(args[0]); 18 | byte companyHolidays = Byte.parseByte(args[1]); 19 | byte totalHolidays =(byte)(nationalHolidays + companyHolidays); 20 | System.out.println("totalHolidays = " + totalHolidays); 21 | } 22 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-30/Question5.java: -------------------------------------------------------------------------------- 1 | Create a class TestFormatter with a main method. The method receives one command line argument. 2 | 3 | Convert the argument received in the main method into a double value. 4 | 5 | Format and print the double value such that it has : 6 | comma (or locale specific) delimiters 7 | a minimum width of 12 characters (put numbers in the front if the number is smaller) 8 | only 3 decimal points 9 | a sign indicator (+ or -) 10 | instead of spaces put zeros(0's) to the left if the number is smaller 11 | [Note: You need not use %n at the end of your formatting text.] 12 | 13 | 14 | 15 | 16 | package q11189; 17 | 18 | 19 | public class TestFormatter{ 20 | 21 | public static void main(String[] args) { 22 | 23 | double ans=Double.parseDouble(args[0]); 24 | 25 | 26 | 27 | System.out.printf("%,+012.3f", ans); 28 | 29 | 30 | 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-14/Question5.java: -------------------------------------------------------------------------------- 1 | Write code which uses if-then-else statement to check if a given account balance is greater or lesser than the minimum balance. 2 | 3 | Write a class BalanceCheck with public method checkBalance that takes one parameter balance of type double. 4 | 5 | Use if-then-else statement and print Balance is low if balance is less than 1000. Otherwise, print Sufficient balance. 6 | 7 | Note: You need not write the main method. You can directly write the checkBalance(double balance) method in the BalanceCheck class. 8 | 9 | Use System.out.println() instead of System.out.print(). 10 | 11 | Note: Please don't change the package name. 12 | 13 | package q10850; 14 | 15 | class BalanceCheck{ 16 | public void checkBalance(double bal){ 17 | if(bal<1000){ 18 | System.out.println("Balance is low"); 19 | }else 20 | System.out.println("Sufficient balance"); 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /Java Course - Lesson Plan - September - 2019/Lab-29/Question13.java: -------------------------------------------------------------------------------- 1 | Create a class StringSplit with a main method. The method receives two command line arguments. First argument is a string. Second argument is a regular expression. 2 | 3 | A regular expression is a sequence of characters that define a search pattern. 4 | 5 | Example: 6 | +, -, *, ]Split the first argument using the regular expression and print the items. Make sure there are no leading or trailing spaces in the items. 7 | 8 | For Example: 9 | Cmd Args: Rama-Lakshmana-Bharatha-Satrugna - 10 | Rama 11 | Lakshmana 12 | Bharatha 13 | Satrugna 14 | 15 | 16 | package q11183; 17 | 18 | 19 | public class StringSplit { 20 | 21 | public static void main(String[] args) { 22 | 23 | String str = args[0]; 24 | 25 | String[] splits = str.split(args[1]); 26 | 27 | for (String s : splits) { 28 | 29 | System.out.println(s.trim()); 30 | 31 | 32 | } 33 | } 34 | } --------------------------------------------------------------------------------