├── _config.yml ├── CNAME ├── 1st_November_exam ├── 1nov.txt ├── JAVA_SET_1_Q1.java ├── JAVA_SET_1_Q4.java ├── JAVA_SET_1_Q2.java ├── JAVA_SET_1_Q3.java └── JAVA_SET_1_Q5.java ├── .gitignore ├── 1st_November_exam_SET-2 ├── JAVA_SET_2_Q1.java ├── JAVA_SET_2_Q2.java ├── JAVA_SET_2_Q4.java ├── JAVA_SET_2_Q5.java └── JAVA_SET_2_Q3.java ├── week 2 ├── Exercise 2.5.java ├── Exercise 2.4.java ├── Exercise 2.1.java ├── Exercise 2.3.java └── Exercise 2.2.java ├── week 12 ├── Exercise 12.3.java ├── Exercise 12.2.java ├── Exercise 12.4.java ├── Exercise 12.5.java └── Exercise 12.1.java ├── week 7 ├── Exercise 7.1.java ├── Exercise 7.2.java ├── Exercise 7.3.java ├── Exercise 7.5.java └── Exercise 7.4.java ├── week 5 ├── Exercise 5.3.java ├── Exercise 5.1.java ├── Exercise 5.5.java ├── Exercise 5.2.java └── Exercise 5.4.java ├── week 4 ├── Exercise 4.1.java ├── Exercise 4.2.java ├── Exercise 4.4.java ├── Exercise 4.3.java └── Exercise 4.5.java ├── week 1 ├── Exercise 1.1.java ├── Exercise 1.3.java ├── Exercise 1.2.java ├── Exercise 1.4.java └── Exercise 1.5.java ├── week 10 ├── Exercise 10.1.java ├── Exercise 10.3.java ├── Exercise 10.2.java ├── Exercise 10.5.java └── Exercise 10.4.java ├── week 8 ├── Exercise 8.5.java ├── Exercise 8.1.java ├── Exercise 8.3.java ├── Exercise 8.2.java └── Exercise 8.4.java ├── week 9 ├── Exercise 9.4.java ├── Exercise 9.5.java ├── Exercise 9.1.java ├── Exercise 9.3.java └── Exercise 9.2.java ├── week 6 ├── Exercise 6.2.java ├── Exercise 6.1.java ├── Exercise 6.5.java ├── Exercise 6.3.java └── Exercise 6.4.java ├── week 3 ├── Exercise 3.5.java ├── Exercise 3.4.java ├── Exercise 3.1.java ├── Exercise 3.2.java └── Exercise 3.3.java ├── week 11 ├── Exercise 11.4.java ├── Exercise 11.5.java ├── Exercise 11.3.java ├── Exercise 11.2.java └── Exercise 11.1.java └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-time-machine -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | https://sumitnce1.github.io/Programming-in-Java-NPTEL/ 2 | -------------------------------------------------------------------------------- /1st_November_exam/1nov.txt: -------------------------------------------------------------------------------- 1 | Hey geeks, 2 | here 1st november exam answer avialable. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | -------------------------------------------------------------------------------- /1st_November_exam/JAVA_SET_1_Q1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class Question1{ 3 | public static void main(String args[]){ 4 | int n; 5 | 6 | ~~~THERE IS SOME INVISIBLE CODE HERE~~~ 7 | 8 | // write code from below... 9 | System.out.print((n*(n+1))); 10 | 11 | 12 | 13 | } // main() ends here 14 | } // class Question1 ends here -------------------------------------------------------------------------------- /1st_November_exam_SET-2/JAVA_SET_2_Q1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class Question1 { 3 | public static void main(String[] args) { 4 | 5 | 6 | 7 | Scanner s = new Scanner(System.in); 8 | int n = s.nextInt(); 9 | 10 | int x = 1; 11 | int sum = 0; 12 | for (int i = 0; i < n; i++) 13 | { 14 | sum += x; 15 | x += 2; 16 | 17 | } 18 | System.out.print(sum); 19 | }} -------------------------------------------------------------------------------- /week 2/Exercise 2.5.java: -------------------------------------------------------------------------------- 1 | //To debug the program which is intended to print 'NPTEL JAVA'. 2 | public class Question215{ 3 | public static void main(String[] args) { 4 | //Declare variable with name 'nptel', 'space' and 'java' and proper datatype. 5 | String nptel,space,java; 6 | //Initialize the variables with proper input 7 | nptel="NPTEL"; 8 | space=" "; 9 | java="JAVA"; 10 | System.out.print(nptel+space+java); 11 | } 12 | } -------------------------------------------------------------------------------- /week 12/Exercise 12.3.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class Question3{ 3 | public static void main(String[] args){ 4 | Scanner s1 = new Scanner(System.in); 5 | 6 | 7 | String sumitnce=s1.nextLine(); 8 | String nce=s1.nextLine(); 9 | 10 | int roll=s1.nextInt(); 11 | 12 | double s1nce=s1.nextDouble(); 13 | double s2nce=s1.nextDouble(); 14 | 15 | double avg=(s1nce+s2nce)/2; 16 | 17 | System.out.print(sumitnce+nce+" "+roll+" "+avg); 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /week 2/Exercise 2.4.java: -------------------------------------------------------------------------------- 1 | //To call default constructor first and then any other constructor in the class Answer. 2 | // This is the main class Question 3 | public class Question214{ 4 | public static void main(String[] args){ 5 | Answer a = new Answer(10,"MCQ"); 6 | } 7 | } 8 | class Answer{ 9 | Answer(){ 10 | System.out.println("You got nothing."); 11 | } 12 | Answer(int marks, String type){ 13 | this(); 14 | System.out.println("You got "+marks+" for an "+ type); 15 | } 16 | } -------------------------------------------------------------------------------- /1st_November_exam_SET-2/JAVA_SET_2_Q2.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class Question2{ 3 | public static void main(String[] args) { 4 | 5 | 6 | Scanner su=new Scanner(System.in); 7 | int s=su.nextInt(); 8 | int min,arr[]; 9 | arr=new int[s]; 10 | for(int i=0;iarr[i]) 16 | min=arr[i]; 17 | } 18 | System.out.print(min); 19 | } 20 | } 21 | 22 | 23 | -------------------------------------------------------------------------------- /1st_November_exam_SET-2/JAVA_SET_2_Q4.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class Question4{ 3 | public static void main(String[] args) { 4 | Scanner sc = new Scanner(System.in); 5 | 6 | Scanner s = new Scanner(System.in); 7 | char ch = s.next().charAt(0); 8 | if((ch>=65&&ch<=90)||(ch>=97&&ch<=122)) 9 | if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U') 10 | System.out.print("vowel"); 11 | else 12 | System.out.print("Not_vowel"); 13 | } 14 | } -------------------------------------------------------------------------------- /1st_November_exam/JAVA_SET_1_Q4.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class Question4{ 3 | public static void main(String args[]){ 4 | 5 | 6 | Scanner s=new Scanner(System.in); 7 | char ch = s.next().charAt(0); 8 | if( (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')){ 9 | ch = Character.toLowerCase(ch); 10 | if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ){} 11 | else{ 12 | System.out.print("Consonant"); 13 | } 14 | } 15 | 16 | } // main() ends here 17 | } // Class Question4 ends here -------------------------------------------------------------------------------- /1st_November_exam/JAVA_SET_1_Q2.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class Question2{ 3 | public static void main(String args[]){ 4 | int arr[] = new int[20]; 5 | 6 | // Array initialization is hidden 7 | 8 | ~~~THERE IS SOME INVISIBLE CODE HERE~~~ 9 | 10 | int max = arr[0]; 11 | 12 | for(int j=0 ; j