Programming In Java | Week 1
Session: JAN-APR 2024
Course name: Programming In Java
Course Link: Click Here
For answers or latest updates join our telegram channel: Click here to join
These are NPTEL Programming In Java Week 1 Assignment 1 Answers
Q1. What is the primary focus of Java programming? a. Low-level optimizations b. Hardware-specific operations c. Platform independence d. Assembly language programming
Answer: c. Platform independence
Q2. Which of the following programming principles is a key aspect of Java? a. Code obfuscation b. Platform dependence c. Object-oriented programming d. Global variables
Answer: c. Object-oriented programming
Q3. What is the last step in the Java programming process? a. Java Program Execution b. Java Program Editing c. Java Program Compilation d. C/C++ versus Java
Answer: a. Java Program Execution
Q4. Which of the following is NOT a Java programming tool? a. Eclipse b. NetBeans c. IntelliJ IDEA d. GCC
Answer: d. GCC
Q5. What does the term “Write Once, Run Anywhere” (WORA) imply in Java? a. Code reusability b. Platform independence c. Cross-compilation d. Dynamic typing
Answer: b. Platform independence
Q6. In Java, what is used to store multiple values of the same type? a. Structures b. Pointers c. Arrays d. Lists
Answer: c. Arrays
Q7. Which of the following is a valid identifier in Java? a. 123identifier b. _identifier c. #identifier d. identifier-123
Answer: b. _identifier
Q8. What is the purpose of Java Language Subset? a. To limit the capabilities of Java b. To make Java code compatible with other languages c. To define a smaller set of Java features for specific purposes d. To enhance the performance of Java programs
Answer: c. To define a smaller set of Java features for specific purposes
Q9. What is the primary purpose of the Java Virtual Machine (JVM) in the Java programming language? a. Code optimization b. Platform independence c. Memory management d. Hardware-specific operations
Q10. What is emphasized during the Java Program Editing phase? a. Writing platform-specific code b. Debugging the program c. Compiling the program d. Writing and modifying the source code
Answer: d. Writing and modifying the source code
More Weeks of Programming In Java: Click here
More Nptel Courses: https://progiez.com/nptel-assignment-answers
Session: JULY-DEC 2023
Course Name: Programming In Java
Programming Assignment
Question 1 Complete the code segment to find the perimeter and area of a circle given a value of radius. You should use Math.PI constant in your program. If radius is zero or less than zero then print ” please enter non zero positive number “.
Question 2 Complete the code segment to find the largest among three numbers x,y, and z. You should use if-then-else construct in Java.
Question 3 Consider First n even numbers starting from zero(0).Complete the code segment to calculate sum of all the numbers divisible by 3 from 0 to n. Print the sum. Example: Input: n = 5 ——- 0 2 4 6 8 Even number divisible by 3:0 6 sum:6
Question 4 Complete the code segment to check whether the number is an Armstrong number or not. Armstrong Number: A positive number is called an Armstrong number if it is equal to the sum of cubes of its digits for example 153 = 1 3 +5 3 +3 3 , 370, 371, 407, etc.
Question 5 Complete the code segment to help Ragav , find the highest mark and average mark secured by him in “s” number of subjects.
More Nptel Courses: Click here
Session: JAN-APR 2023
Course Name: NPTEL Programming In Java Assignment
Week 2: Click Here
Q1) What is the incorrect statement about bytecode? a. Java when compiles the source code, it converts it to bytecode. b. JVM (Java Virtual Machine) is an interpreter of bytecode. c. Bytecode is not portable and it needs to be compiled separately for each platform. d. JVM offers a protected environment which helps in enhanced safety for the system.
Answer: c. Bytecode is not portable and it needs to be compiled separately for each platform.
Q2) Consider the following program What is the output of the above code? a. a b. Compiler error due to line n1 c. Compiler error due to line n2 d. Print nothing
Answer: d. Print nothing
Q3) Which one of the following is not a primitive datatype? a. byte b. short c. class d. long
Answer: c. class
Q4) Which of the following is not a keyword in java? a. final b. super c. integer d. extend
Answer: c, d
Q5) Consider the following program What will be the output of the program if it is executed? a. 15-even-1 b. 15-odd-1 c. 15-even- d. 15-odd-
Answer: b. 15-odd-1
Q6) Why does the error âjavac is not recognized as an internal or external commandâ occur? a. Path is not set for java b. JDK is not correctly installed c. .class file is not found d. javac jar is missing from java library
Answer: a. Path is not set for java
Q7) Following is a piece of code where some parts of a statement is missing: In the following, some options are given. You have to choose the correct option(s) for the argument in System.out.print() function to print the value 102. a. nptel[nptel.length-2] + nptel[0] b. nptel[0] + nptel[nptel.length-2] c. ââ + nptel[nptel.length-2] + nptel[0] d. ââ + nptel[0] + nptel[nptel.length-2]
Answer: a, b
Q8) Which of the following concept that Java doesnât support? a. inheritance b. serialization c. goto d. array
Answer: c. goto
Q9) The subsystem of JVM that is used to load class files is known as ______. a. Classloader b. JRE c. JDK d. Compiler
Answer: a. Classloader
Q10) What is the value of total after executing the following code snippet? int mark = 5; int grace = 2; int total = mark + (mark > 6 ? ++grace : âgrace); a. 6 b. 5 c. 4 d. 3
Answer: a. 6
Assignment Solution
Complete the code segment to help Ragav , find the highest mark and average mark secured by him in âsâ number of subjects.
Consider First n even numbers starting from zero(0).Complete the code segment to calculate sum of all the numbers divisible by 3 from 0 to n. Print the sum. Example: Input: n = 5 ââ- 0 2 4 6 8 Even number divisible by 3:0 6 sum:6
Complete the code segment to find the perimeter and area of a circle given a value of radius. You should use Math.PI constant in your program. If radius is zero or less than zero then print â please enter non zero positive number â.
Complete the code segment to check whether the number is an Armstrong number or not. Armstrong Number: A positive number is called an Armstrong number if it is equal to the sum of cubes of its digits for example 153 = 1 3 +5 3 +3 3 , 370, 371, 407, etc.
Complete the code segment to find the largest among three numbers x,y, and z. You should use if-then-else construct in Java.
Session: JULY-DEC 2022
1. What of the following can be used for a variable name in java? a. Byte b. Throw c. This d. Extend
Answer: Please login to see answer .
2. A platform is the hardware or software environment in which a program runs. Which of the following is/are java platform component? a. HTML b. Java Virtual Machine c. Java application programming interface(API) d. HotJava
3. What is the value returned by the method f() define below? Public static int f(int x, int y) {return (x>y) ? y: x; }
- The sum of x and y that is, x + y.
- Thee difference of x and y that is, x-y.
- The maximum of x and y that is,the large r value of x and y
- The minimum of x and y that is, the smaller r value of x and y
4. A java file with extension â.classâ contains
- Java source code
- Java byte code
- A program file written in java programming language
5. Which of the following is used to find and fix bus in the Java programs?
6. What will be the output of the program if it is executed?
What will be the output of the program if it is executed?
ANSWER:- a
7. Following is a piece of code where some part of the statement is missing :
In the following , some option are given. You have to choose the correct option for the argument in system.out.print() function to print the first and the last but one characters in the array nptel.
- nptel[nptel.length-2] + nptel[0]
- nptel[0] + nptel[nptel.length-2]
- ââ + nptel[nptel.length-2] + nptel[0]
- ââ + nptel[0] + nptel[nptel.length-2]
8. Consider the following program .
- Print first six even numbers.
- Print first six odd numbers.
- Print first five even number.
- Print first six Fibonacci numbers.
9. Int N = Integer.parseInt (args[])
10. Consider the following program.
- Print the value of N!
- Print the value of N(N+1)/2
- Print the value of 1*3*3*âŠâŠâŠâŠ..* N
- Print the value of 1!*2!*3!*âŠâŠâŠâŠâŠ*N!
Programming Assignment Answers
Q1. Complete the code segment to find the perimeter and area of a circle given a value of radius.
You should use Math.PI constant in your program. If radius is zero or less than zero then print â please enter non zero positive number â.
Q2. Complete the code segment to find the largest among three numbers x,y, and z. You should use if-then-else construct in Java.
Q3. Consider First n even numbers starting from zero(0). Complete the code segment to calculate sum of all the numbers divisible by 3 from 0 to n. Print the sum.
4. Complete the code segment to check whether the number is an Armstrong number or not.
Q5. Complete the code segment to help Ragav , find the highest mark and average mark secured by him in âsâ number of subjects.
* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first. COPYING MATERIALS IS STRICTLY PROHIBITED.
MORE NPTEL ANSWERS: CLICK HERE
IMAGES
VIDEO
COMMENTS
NPTEL Assignment Answers and Solutions 2024 (July-Dec). ... Welcome to the NPTEL "Programming in Java" course repository! This repository hosts a comprehensive collection of programming assignments, quizzes, and test solutions for the NPTEL "Programming in Java" course offered in the years 2024, 2022, and 2020.
Java Week 6:Q2 In the following program, a thread class ThreadRun is created using the Runnable interface which prints "Thread using Runnable interface". Complete the main class to create a thread object of the class ThreadRun and run the thread, Java Week 6:Q3 A part of the Java program is given, which can be completed in many ways, for example using the concept of thread, etc. Follow the ...
Welcome to the NPTEL "Programming in Java" course repository! This repository hosts a comprehensive collection of programming assignments, quizzes, and test solutions for the NPTEL "Programming in Java" course offered in the years 2024, 2022, and 2020.
Programming in Java NPTEL Week 2 Programming Assignment 1 Solutions. Complete the code segment to call the method print() of class Student first and then call print() method of class School. // This is the class named School class School { // This is a method in class School public void print() { System.out.println("Hi!
Programming in Java NPTEL 2022 Week 12 Quiz Solutions. Q1. Which statement is true in case of using "this" keyword in a static method? a) "this" keyword can be used in static method to access static variables only. b) "this" keyword can't be used in static method. c) "this" keyword can be used in static method. d) None.
Week 4: Programming Assignment 4 Solution. Complete the code segment to call the default method in the interface First and Second. interface First{// default method default void show(){System.out.println("Default method implementation of First interface.");}} interface Second{// Default method default void show(){System.out.println("Default ...
đ Welcome to my NPTEL Programming in Java repository! đ This repository is a comprehensive collection of my solutions and detailed notes for the NPTEL Programming in Java course. It's designed for learners, Java enthusiasts, and anyone eager to delve into the world of Java programming. Resources
October 2022 NPTEL Exams - Hall Tickets Released! ... Programming In Java - Assignment- 7,8,9,10 & 11 Solution Released Dear Participants, The Assignment-7,8,9 ... You will have to write your answers on sheets of paper and submit the answer sheets. Papers will be sent to the faculty for evaluation.
Join our Telegram Channel : https://telegram.me/SwayamSolverLink of Code :-https://programified.blogspot.com/2022/07/programming-in-java-july-2022-programs.h...
Programming in Java NPTEL Week 7 Programming Assignment 1 Solutions. 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. // Write the appropriate statement(s) to import the package(s) you need in your program ...
These are NPTEL Programming In Java Week 1 Assignment 1 Answers. Question 3. Complete the code segment to find the perimeter and area of a circle given a value of radius. You should use Math.PI constant in your program. If radius is zero or less than zero then print " please enter non zero positive number ". Solution:
Week 1 : Overview of Object-Oriented Programming and Java. Week 2: Java Programming Elements. Week 3: Input-Output Handling in Java. Week 4: Encapsulation. Week 5: Inheritance. Week 6: Exception Handling. Week 7: Multithreaded Programming. Week 8: Java Applets and Servlets. Week 9: Java Swing and Abstract Windowing Toolkit (AWT)
Week 5: Programming Assignment 5 Solution. In the following program, there may be multiple exceptions. You have to complete the code using only one try-catch block to handle all the possible exceptions. For example, if user's input is 1, then it will throw and catch "java.lang.NullPointerException". j = 92/ zero; break; case 1: int b ...
Nptel assignment answer for Java Programming. java nptel-assignments Updated Apr 12, 2024; progiez / nptel-assignmnet-answers Star 8. Code Issues Pull requests ... and test solutions for the NPTEL "Programming in Java" course offered in the years 2024, 2022, and 2020.
By following these steps, you can easily locate and use the assignment answers and solutions for the NPTEL courses provided in this repository. We hope this resource assists you in your studies! List of Courses
Week 6: Programming Assignment 4 Solution. Execution of two or more threads occurs in a random order. The keyword 'synchronized' in Java is used to control the execution of thread in a strict sequence. In the following, the program is expected to print the output as given below. Do the necessary use of 'synchronized' keyword, so that ...
NPTEL Programming In Java Assignment 8 Answers 2022:-. Q1. Write a program which will print a pyramid of "*" 's of height "n" and print the number of "*" 's in the pyramid. Code:-. import java.util.*; public class Pattern1 {.
Java Week 1:Q1 To find the perimeter and area of a circle given a value of radius. Java Week 1:Q2 To find the largest among three numbers x, y, and z. Java Week 1:Q3 Consider First n even numbers starting from zero (0) and calculate sum of all the numbers divisible by 3 from 0 to n. Print the sum. Java Week 1:Q4 To check whether the number is ...
Programming Assignments: Dive into hands-on coding exercises that reinforce key concepts covered in the course.Each assignment presents unique challenges to sharpen your Java programming skills. Quizzes: Test your understanding of Java programming with quizzes designed to assess your knowledge and comprehension of course topics.Challenge yourself and track your progress as you advance through ...