0% found this document useful (0 votes)
3 views3 pages

Exercise of Lesson-4 Program Coding

The document is a lesson on program coding, specifically focusing on Java programming language concepts. It includes objective questions, short and long answer type questions, and application-based queries regarding operators, features of Java, and error identification in code snippets. The content is structured into sections that test knowledge on Java syntax, operators, and programming fundamentals.

Uploaded by

Sandeep Dogra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Exercise of Lesson-4 Program Coding

The document is a lesson on program coding, specifically focusing on Java programming language concepts. It includes objective questions, short and long answer type questions, and application-based queries regarding operators, features of Java, and error identification in code snippets. The content is structured into sections that test knowledge on Java syntax, operators, and programming fundamentals.

Uploaded by

Sandeep Dogra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lesson-4

Program Coding

Section-A (Objective)

A. Tick the correct option.


1. It is platform-dependent language.
2. All of these
3. Variables
4. James Gosling
5. Priya $pay

B. Write True or False.


1. True
2. True
3. True
4. False
5. False

C. Match the columns.


Column A Column B
1. = = a. Assignment operator
2. = b. Unary operator
3. || c. Equality operator
4. + + d. Logical OR operator

D. Fill in the blanks.


1. High-level
2. Output
3. Operators
4. Identifier
5. Primitive

Section-B (Subjective)

A. Short answer type questions.


1. Java is an object-oriented and high-level programming language. It was develop by James
Gosling at Sun Microsystems in 1995.
2. It is used to assign values to operands. The commonly used assignment operators is equal
( = ). This operator can also be used with arithmetic operators to make the shorthand
assignment operators.
3. Arithmetic operators are used to do basic mathematical calculations. These are known as
binary operators which mean they require two operands to perform calculations. E.g. + , - , *,
etc.
B. Long answer type questions.
1. Four features of Java are:
1. Java is a case sensitive language.
2. It supports object-oriented programming concepts of classes and objects.
3. It is platform independent.
4. It is a secure programming language.
2. Logical operators are used to combine multiple conditions and evaluate them. They return
boolean value true or false as result. Two logical operator are: Logical AND ( && ) and
Logical OR ( || )
3. Unary operators are special operators which require only one operand or value to perform
operations. Java provides only two unary operators + + and - -

C. What will be the output?


1. c = 2 * 3.14 * 2.3;
c = 14.444
Output: 14.444

2. GST = 5 * 2 / 100 = 10 / 100 = 0.1


3. inv = 2 + 0.1 = 2.1
Output: GST to be paid:0.1
Total invoice value:2.1
4. c = 10;
a = 20;
b = 10;
Output: Value of a is:20
Value of b is:10

5. name = “Kittu” + “ “ + “Sharma” ;


name = Kittu Sharma
Output: Kittu Sharma

6. age = age + 1 = 17 + 1 = 18
age + + implies age = age + 1 = 18 + 1 = 19
+ +age implies age = age + 1 = 19 + 1 = 20
Output: 20

7. 5 > 5 false
5 = = 5 false
Output: false
true

8. a++ + ++a implies 5 + 7 = 12


b++ + b++ implies 6 + 7 = 13
Output: 12
13
D. Find the errors.
1. public class program{
public static void main(String[] args){
int a = 10;
int b = 20;
int c = a + b;
}
}
2. public class assignment{
public static void main(String[] args){
int a = = 10;
System.out.println(a);
}
}

3. public class D3{


public static void main(String[] args){
int a = 5;
String name = “Chirag”;
System.out.println(a + name);
}
|}
4. public class D4{
public static void main(String[] args){
System.out.println(“Welcome”);
}
}

A. Application based questions.


1. Unary ( + + ) operator
2. String

B. Guess Who Am I?
1. Java
2. = =
3. Variable
4. Keyword
5. int
6. Comment
7. System.out.println( );

You might also like