Docsity

JAVA Programming Question And Answers Exams Latest 2023, Exams of Nursing

Toggle sidebar
bg1
JAVA Programming Question And Answers
Exams Latest 2023
object - Correct Answer โœ…capable of receiving messages, processing
information or data, and sending messages to another/a class created
at runtime
Class - Correct Answer โœ…a blueprint which describes methods,
functions, and constructors
Encapsulation - Correct Answer โœ…wrapping data in a single unit
Data Abstraction - Correct Answer โœ…hiding data; Hiding the irrelevant
features and exposing only the needed features of a particular object
Polymorphism - Correct Answer โœ…the same class name can have many
different functions
Inheritance - Correct Answer โœ…transferring the properties of one class
to another
Platform Independence - Correct Answer โœ…Java's power comes from the
ability to compile code that can be read on any computer that has the
Java Virtual Machine installed.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download JAVA Programming Question And Answers Exams Latest 2023 and more Exams Nursing in PDF only on Docsity!

Exams Latest 2023

object - Correct Answer โœ… capable of receiving messages, processing information or data, and sending messages to another/a class created at runtime Class - Correct Answer โœ… a blueprint which describes methods, functions, and constructors Encapsulation - Correct Answer โœ… wrapping data in a single unit Data Abstraction - Correct Answer โœ… hiding data; Hiding the irrelevant features and exposing only the needed features of a particular object Polymorphism - Correct Answer โœ… the same class name can have many different functions Inheritance - Correct Answer โœ… transferring the properties of one class to another Platform Independence - Correct Answer โœ… Java's power comes from the ability to compile code that can be read on any computer that has the Java Virtual Machine installed.

Exams Latest 2023

Object-Oriented - Correct Answer โœ… Java is object-oriented, thus each program is built from objects and classes. Compiler/Interpreter - Correct Answer โœ… The Java compiler translates the original code into bytecode so that any computer with JVM installed can run the compiled code, regardless of platform or operating system. Robust - Correct Answer โœ… Before executing a program, JVM conducts an overall checking of the program and gives reports of any malfunction.Thus, JVM is a robust programming language. Memory Management - Correct Answer โœ… Memory management is automatically handled by Java Virtual Machine, which means the programmer does not need to write code to manage memory. Performance - Correct Answer โœ… Properly written Java programs execute quickly and use little memory. Networking - Correct Answer โœ… Java works on internet and intranet applications alike. Javadoc - Correct Answer โœ… To avoid mistakes and problems later as the program becomes longer and complex, you need to include comment

Exams Latest 2023

Private Protected These access modifiers are used with classes, methods, and variables. If - Correct Answer โœ… in the event that, i.e. If this occurs, that might happen. Then - Correct Answer โœ… at that time, i.e. I walked into the office and then went to sit down. Else - Correct Answer โœ… otherwise, i.e. You must do this or else go to bed. Switch - Correct Answer โœ… to shift from one to the other, i.e. Please switch places with me. While - Correct Answer โœ… a period of time marked by a condition, i.e. Stay here while I go see the doctor. Return - Correct Answer โœ… a statement which gives the output of the specific task. This will be used when you implement the conditional statement.

Exams Latest 2023

Public - Correct Answer โœ… accessible or shared by all members, i.e. I went into the public restroom. Static - Correct Answer โœ… not moving, i.e. The static content on the screen did not move. single line comment - Correct Answer โœ… //...... multi line comment - Correct Answer โœ… /..../ boolean - Correct Answer โœ… a one-bit value (one digit) represented true or false, 1 or 0 float - Correct Answer โœ… a 4-byte value that represents values from 1.40129846432481707 x 10-45 to 3. identifier - Correct 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 - Correct Answer โœ… As its name, an assignment operator assigns a value to a variable. An assignment operator is

Exams Latest 2023

! NOT

&& operator - Correct Answer โœ… This logical operator represents the logical operation AND in Java. This expression shows the result true if both its operands have the same value and false if not. X Y X&&Y 1 1 1 1 0 0 0 1 0 0 0 0 Note: 1 represents true, 0 represents false || operator - Correct Answer โœ… This operator represents the logical operation OR in Java. This expression shows the result false only if both its operands have the same value, and true even if one value is satisfied. X Y X||Y 1 1 1 1 0 1 0 1 1 0 0 0 Note: 1 represents true, 0 represents false

Exams Latest 2023

! operator - Correct Answer โœ…! represents the logical operation NOT. In this type of operator the result is the opposite of the first operand. X Y X! 1 1 0 1 0 0 0 1 1 0 0 1 Note: 1 represents true, 0 represents false In this operation, if X is true then the resulting value will be false. This logical operator is used primarily to construct multiple conditional statements. bitwise operators - Correct Answer โœ… Anything and everything in the computer's memory is stored as a bit represented by 1s and 0s. So, the machine language of a computer is 1 and 0. It's that simple. Programmers use bitwise operators to manipulate these bits. & Exclusive AND ^ Exclusive OR | Inclusive OR compound operators - Correct Answer โœ… A Compound operator is a combination of arithmetical and assignment operators.

  • = Increments the value of the variable

Exams Latest 2023

switch statement - Correct Answer โœ… in Java you use Switch statements to control the flow of the program. Switch statements access a particular case when needed. Switch statement works with most of the data types such as 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; }

Exams Latest 2023

For Statement - Correct 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 } While Statement - Correct Answer โœ… The While loop evaluates the condition first, and the execution starts only if the condition is found to be true. initialization; while (Condition) { Statement; increment/Decrement; } Do-While Statement - Correct Answer โœ… Do-while statements are different from the other iteration statements. Instead of checking the

Exams Latest 2023

Private Access Modifiers - Correct 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. To take full 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 - Correct 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) { ................... }

Exams Latest 2023

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