NPTEL Programming In Java Assignment 7 Answers 2022

NPTEL Programming In Java Assignment 7

Are you looking for the Answers to NPTEL Programming In Java Assignment 7? This article will help you with the answer to the National Programme on Technology Enhanced Learning (NPTEL) Course NPTEL Programming In Java Assignment 7

What is Programming In Java?

With the growth of Information and Communication Technology, there is a need to develop large and complex software. Further, those software should be platform independent, Internet enabled, easy to modify, secure, and robust. To meet this requirement object-oriented paradigm has been developed and based on this paradigm the Java programming language emerges as the best programming environment. Now, Java programming language is being used for mobile programming, Internet programming, and many other applications compatible to distributed systems. This course aims to cover the essential topics of Java programming so that the participants can improve their skills to cope with the current demand of IT industries and solve many problems in their own filed of studies.

CRITERIA TO GET A CERTIFICATE

Average assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.

Below you can find the answers for NPTEL Programming In Java Assignment 7

Assignment No.Answers
Programming In Java Assignment 1 Click Here
Programming In Java Assignment 2 Click Here
Programming In Java Assignment 3 Click Here
Programming In Java Assignment 4 Click Here
Programming In Java Assignment 5 Click Here
Programming In Java Assignment 6 Click Here
Programming In Java Assignment 7 Click Here
Programming In Java Assignment 8 Click Here

NPTEL Programming In Java Assignment 7 Answers:-

Q1. Complete the following code fragment to read three integer values from the keyboard and find the sum of the values. Declare a variable “sum” of type int and store the result in it.

import java.util.*;
        public class Question1{ 
        public static void main (String[] args){ 
	        
             int i,number=0,sum=0;
             Scanner sc = new Scanner(System.in);
		for (i=0;i<3;i++)
		{
		    number = sc.nextInt();
		    
  		    sum =sum+number;
          
        }

Q2. Complete the code segment to catch the exception in the following, if any. On the occurrence of such an exception, your program should print “Please enter valid data” .If there is no such exception, it will print the “square of the number”.

For Online programming test help and final exam preparation material Click Me

try {  
     InputStreamReader y=new InputStreamReader(System.in);  
     BufferedReader b=new BufferedReader(y);  
     String number=b.readLine();  
     int n = Integer.parseInt(number);
     System.out.println(n*n);
    }
   catch (Exception e)
   {
       System.out.println("Please enter valid data");
    }

Next Week Answers: Assignment 07

quizxp telegram

Q3. A byte char array is initialized. You have to enter an index value”n”. According to index your program will print the byte and its corresponding char value.
Complete the code segment to catch the exception in the following, if any. On the occurrence of such an exception, your program should print “exception occur” .If there is no such exception, it will print the required output.

String s = new String(barr,n,1);  
System.out.println(barr[n]);
System.out.println(s); 
}

Q4. The following program reads a string from the keyboard and is stored in the String variable “s1”. You have to complete the program so that it should should print the number of vowels in s1 . If your input data doesn’t have any vowel it will print “0”.

for(int a=0;a<s1.length();a++)
     {  
          char str=s1.charAt(a);
          if(str=='e' || str=='E'|| str=='a' || str=='A' || str=='i' || str=='I' || str=='o' || str=='O' || str=='u' || str=='U') 
	     {
	       c=c+1;
         }  
     }

Q5. A string “s1” is already initialized. You have to read the index “n”  from the keyboard. Complete the code segment to catch the exception in the following, if any. On the occurrence of such an exception, your program should print “exception occur” .If there is no such exception, your program should replace the char “a” at the index value “n” of the “s1” ,then it will print the modified string.

 byte[] b=s1.getBytes();   
	      
                byte B = (byte) c;
            	b[n]=B;
		System.out.println(new String(b)); 
	   }

For other courses answers:- Visit

For Internship and job updates:- Visit

Disclaimer: We do not claim 100% surety of answers, these answers are based on our sole knowledge, and by posting these answers we are just trying to help students, so we urge do your assignment on your own.

if you have any suggestions then comment below or contact us at [email protected]

If you found this article Interesting and helpful, don’t forget to share it with your friends to get this information.