Java Programming Fundamentals: Definitions and Concepts, Exams of Computer Science

A comprehensive glossary of fundamental java programming concepts, definitions, and explanations. It covers key topics such as object-oriented programming, data types, operators, control flow statements, access modifiers, and more. Suitable for beginners learning java programming and serves as a valuable reference for understanding core concepts.

Typology: Exams

2024/2025

Available from 01/09/2025

Upstudy
Upstudy 🇺🇸

2.8

(9)

14K documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
JAVA TEST QUESTIONS AND
CORRECT ANSWERS
object - ANSWER that receives messages, and processes information or data
and also sends messages to another/ a class instantiated at runtime
Class - ANSWER blueprint that defines methods, functions, and constructors
Encapsulation - ANSWER data packed in a single unit
Data Abstraction - ANSWER hidden data; Hiding the irrelevant features and
showing only the needed features of a particular object
Polymorphism - ANSWER the ability of the same name to have multiple
different functions
Inheritance - ANSWER passing the properties of one class to another
Platform Independence - ANSWER The power of Java derives from the
language's ability to compile code into which can be read on any computer that
has the JVM installed.
Object-Oriented - ANSWER Java is object-oriented, with every program in it
being built around objects and classes.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Java Programming Fundamentals: Definitions and Concepts and more Exams Computer Science in PDF only on Docsity!

JAVA TEST QUESTIONS AND

CORRECT ANSWERS

object - ANSWER that receives messages, and processes information or data and also sends messages to another/ a class instantiated at runtime Class - ANSWER blueprint that defines methods, functions, and constructors Encapsulation - ANSWER data packed in a single unit Data Abstraction - ANSWER hidden data; Hiding the irrelevant features and showing only the needed features of a particular object Polymorphism - ANSWER the ability of the same name to have multiple different functions Inheritance - ANSWER passing the properties of one class to another Platform Independence - ANSWER The power of Java derives from the language's ability to compile code into which can be read on any computer that has the JVM installed. Object-Oriented - ANSWER Java is object-oriented, with every program in it being built around objects and classes.

Compiler/Interpreter - ANSWER A Java compiler first compiles the source into bytecode. Then, any computer that has JVM installed can run the compiled code without taking into consideration either the platform or operating system. Robust- ANSWER Before execution of program, JVM does an overall checking of the program and reports of any malfunction are given. So, JVM is a robust programming language. Memory Management- ANSWER Memory management is automatically done by Java Virtual Machine, which means that the programmer doesn't need to write code for memory management. Performance - ANSWER Well-written Java programs execute quickly and use little memory. Networking - ANSWER Java operates on both Internet and intranet-based programs. Javadoc - ANSWER To avoid errors and issues later as the program gets lengthy and complicated, you must incorporate comment statements within your program that define the purpose of the program or section of code/this documentation of comments Comment Opener - ANSWER /*** [line for comment] ***/ operators - ANSWER. iteration statements - ANSWER Iteration statements repeat a function until a certain value or condition is satisfied.

Public - ANSWER accessible or shared by all members, i.e. I went into the public restroom. Static - ANSWER not moving, i.e. The static content on the screen did not move. single line comment - ANSWER //. multi line comment - ANSWER /****.****/ boolean - ANSWER a one-bit value (one digit) represented true or false, 1 or 0 float - ANSWER a 4-byte value that represents values from 1.40129846432481707 x 10-45 to 3. identifier - ANSWER must start with a letter. It can be followed by a combination of numbers and two allowed special characters: underscore '_' and dollar sign '. When naming identifiers you need to be careful not to use any Java keywords. assignment operator - ANSWER As its name, an assignment operator assigns a value to a variable. An assignment operator is represented by an equal sign. (X=5) With an assignment operator, Java runs the program from the right side to the left side. All other operators are evaluated from left to right. arithmetic operators - ANSWER Addition + Subtraction -

Multiplication * Division / Modulo Division % relational operators - ANSWER Greater Than > Less Than < Greater Than or Equal To >= Less Than or Equal To <= Equal To == Not Equal To!= logical operators - ANSWER These operators are used to evaluate two expressions. The evaluation stops as soon as the result is known. && AND || OR ! NOT && operator - ANSWER This logical operator in Java represents the logical operation AND. This expression returns true if both operands have the value true and false if otherwise. X Y X&&Y 1 1 1 1 0 0 0 1 0 0 0 0 Note: 1 stands for true, and 0 stands for false

  • = Incremental operation of a variable
  • = Decremental operation of variable conditional operators - ANS [Condition]? [Statement for true]: [Statement for false]; selection statements - ANS The selection statement return values for either true or false. Which means the program will be executing either true or false until the conduction is met simple if condition - ANS if (Condition) { //true block } if else statement - ANS if (Condition) //return true } else { //return false } Switch Statement - ANSWER in Java switch statements are used to control the flow of a program. It will access that particular case which is necessary for switch statement. A switch statement will work with almost most of the data types that includes byte, short, char and int.

switch (expression) { case cond1: code_block_1 ; break; case cond2: code_block_2; break; . case condn: code_block_n; break; default: code_block_default; break; } For Statement - ANSWER When you want to control the number of times the condition has to be done, you want to create a loop. You use a for statement to create a loop. The for statement consists of the keyword for, followed by the three expressions in parenthesis separated by semicolons. These expressions are the initialization expression, test expression and the increment/decrement (re- initialization) expression. for (initialization; condition; increment/decrement) { //statement }

Syntax for Variable: [Access_Modifier] [datatype] [variable] = [value]; Access Modifiers - Private - ANSWER When a method or a variable is declared private, they are not accessible outside their class. By default all methods are private. A private class or method cannot be inherited and it cannot be used in an interface. In order to take the fullest advantage of the object-oriented programming pillar of encapsulation, you should limit access as much as possible within the program. Syntax For method: [Access_Modifier] [Returntype] [Method_Name](args0, args1.argsn) { . } Syntax for variable: [Access_Modifier] [datatype] [variable] = [value]; protected access modifiers - ANSWER A protected access modifier has the similar features to that of private access modifiers, except the method or variable in the class can be inherited. Syntax for Method: [Access_Modifier] [Returntype] [Method_Name](args0, args1.argsn) { .

Syntax for Variable: [Access_Modifier] [datatype] [variable] = [value];