brazerzkidaicosmetics.blogg.se

Bluej exercise solutions chapter 4
Bluej exercise solutions chapter 4














It translates the whole source program into target program at once. (d) Compiler and Interpreter Answer Compiler It is a set of statements in Machine Language. It is a set of statements in a High-Level programming language.

#Bluej exercise solutions chapter 4 code

(c) Source code and Object code Answer Source Code String literals are assigned to variables of type String. String literals are written by enclosing a set of characters within a pair of double quotes.Ĭharacter literals are assigned to variables of type char. (b) Character and String literal Answer Character literalĬharacter literals are written by enclosing a character within a pair of single quotes. Integer literals are assigned to variables of data type - byte, short, int, long, charįloating literals are assigned to variables of data type - float, double (a) Integer and Floating literal Answer Integer Literal It needs to be converted into Machine Code first. Bytecode can't be executed directly on the processor.

bluej exercise solutions chapter 4

Java compiler converts Java source code into an intermediate binary code called Bytecode. As it reads the program line by line so the errors are reported one by one. The compiler processes the complete source program at once and if there are compilation errors, they are all reported together at once.Īn interpreter is a program that reads a source program line by line, converts each line into its equivalent machine code and executes it. It should not be a keyword or a boolean or null literal.Ī compiler is a program that translates a source program written in some high-level programming language into a target program in another low-level programming language without changing the meaning of the program.Name of the variable should be a sequence of alphabets, digits, underscore and dollar sign characters only.What are the rules to assign a variable in Java programming? Answer Its value can't be changed in the program. The keyword final before a variable declaration makes it a constant. What is meant by a constant? Explain with an example. This name of the variable is used in the program to refer to the stored value.

bluej exercise solutions chapter 4

(c) A fractional number ⇒ double Long Answer Questions Question 1Ī variable represents a memory location through a symbolic name which holds a known or unknown value of a particular data type. Write down the data type of the following: println( "The answer = " + sum) //4th correction Question 6 Answerĭouble a = 45.1 //1st correction float b = 15.05f //2nd correction double c = 92 (a) To find the smaller between two numbers. Write down the syntax for the following functions in Java programming: Which of the following is a correct representation? Which of the following syntax is true to find the square root of a number?īoolean data is used to test a particular condition, i.e., true or false. What type of value is returned by the sqrt function? Which of the following is false to find square of a number? The ASCII codes of upper case alphabets range from: The default value of the boolean data type is: Multiple Choice Questions (Tick the correct answers) Question 1Ī constant which gives the exact representation of data is called a/an: Chapter 4 - Unit 1 Data Types in Java Class 8 - APC Understanding Computer Studies with BlueJ














Bluej exercise solutions chapter 4