Prelims Flashcards

1
Q

Who created JAVA and when?

A

James gosling et.al at sun microsystems, 1991

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What was the initial name of java?

A

Oak, it was changed to java because there is already a programming lang named oak

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The motivation for java is the need for platform independent language that could be embedded in various electronic products.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

One of the first projects developed in java

A

A personal hand held remote control named star 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The java technology is

A
  • A programming language
  • Deployment environment
  • Application environment
  • Development environment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

As a programming language, Java can create all
kinds of applications that you could create using
any conventional programming language.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

As a development environment, Java technology provides
you with a large suite of tools which are?

A
  • Interpreter
  • Compiler
  • documentation generator
  • class file packaging tool
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Java technology applications are typically general-
purpose programs that run on any machine where
the Java runtime
environment (JRE) is installed.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Two main deployment environments

A

JRE supplied by java 2 software development kit, and on the web browser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

contains the complete set
of class files for all the Java technology packages,
which includes basic language classes, GUI
component classes, and so on.JRE supplied by java 2 software development kit,

A

JRE supplied by java 2 software development kit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Code for printing output in Java

A

System.out.println(“ “);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Phases of java program

A

Editor - compiler - interpreter

(Write, compile, run)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Features of java

A

Java virtual machine ( JVM)
Garbage collection
Code security

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

An implementation - Its implementation is
known as JRE (Java Runtime Environment).

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Whenever you write java
command on the command prompt to run the
java class, an instance of JVM is created.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Responsible for freeing any memory that could be freed. Happens automatically.

A

Garbage collection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

It is attained in java through the implementation of the java runtime environment

A

Code security

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Runs code for a JVM and performs class loading

A

Java runtime environment (JRE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Responsible for loading all classes needed for java program.

A

Class loader

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Adds security by separating namespaces for the classes of local file system

A

Class loader

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Tests the format of the code fragments and checks the code fragments for illegal codes

A

Bytecode verifier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

programming
style which is associated with the concepts like
class, object, Inheritance, Encapsulation,
Abstraction, Polymorphism.

A

Object oriented programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Traditional procedural-oriented programming
languages (such as C, Fortran, Cobol and Pascal)
suffer some notable drawbacks in
creating reusable software components.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Functions are less reusable.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

about writing procedures or methods
that perform operations on the data,

A

Procedural programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

about creating objects that contain both data and
methods.

A

Object oriented programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Procedural programming has several advantages over object oriented programming

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

The problem solving phases

A
  1. Analysis
  2. General solution
  3. Verify
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Procedural programming
Features

A
  • top down design
  • limited code reuse
  • complex code
  • global data focused
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Object oriented programming features

A
  • object focused
  • code reuse
  • complex design
  • protected data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Advantages of OOP

A
  • faster and easier to execute
  • provides clear structure for programs
  • helps keep the java code dry and easy to modify
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What does DRY means

A

Don’t repeat yourself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What is the basic unit of OOP

A

Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Two main aspects of object oriented programming

A

Classes and objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

like an object constructor,
or a “blueprint” for creating objects.

A

Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

The keyword for creating a new class

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

The keyword for creating a new object

A

new

38
Q

To create a new object, you should:

A

specify the class name, followed by the object
name, and use the keyword new

39
Q

With objects and classes, You can use the existing class created.

A

True

40
Q

Creating objects with classes process

A

Declaration, instantiation, initialization

41
Q

OP languages
permit higher level of
abstraction for solving
real-life problems.

A

True

42
Q

An object oriented program consists of many well incapsulated objects

A

True

43
Q

Benefits of OOP

A

Ease in software design, easy in maintenance, resuable software

44
Q

a definition of objects of the same
kind. it is a blueprint, template, or prototype that
defines and describes the static attributes and dynamic
behaviors common to all objects of the same kind

A

Class

45
Q

realization of a particular item of a class. In other words, an instance is an instantiation of a class

A

Instance

46
Q

The term <blank> usually refers to <blank></blank></blank>

A

Instance

47
Q

A Class is a 3-Compartment Box
Encapsulating Data and Operations

A

True

48
Q

identifies the class.

A

Name

49
Q

contains the static attributes of the class

A

Variables

50
Q

contains the dynamic
behaviors of the class.

A

Methods

51
Q

frequently instantiate
objects that use the objects of other classes
(and their data and methods). Sometimes
you write classes that do both.

A

Application classes

52
Q

The principle used in creating private access is
sometimes called

A

Information hiding

53
Q

_________ in Java is a mechanism to encapsulate a group of classes, sub
packages and interface

A

Package

54
Q

What are the uses of package

A
  1. Preventing naming conflicts.
  2. Making searching/locating and usage of classes, interfaces,
    enumerations and annotations easier
  3. Providing controlled access: protected and default have package level
    access control.
  4. Packages can be considered as data encapsulation (or data-hiding).
55
Q

Two categories of packages in JAVA

A

Built in packages (from java API)
And user defined packages

56
Q

The library is divided into _______ and _________

A

Packages and classes

57
Q

Syntax for importing a single class

A

import package.name.Class;

58
Q

Syntax for importing a whole package

A

import package.name.*;

59
Q

___________ is used to process the input and
produce the output.

A

Java (I/O) input and output

60
Q

contains all the classes required for
input and output operations.

A

java.io package

61
Q

Standard output stream

A

System.out

62
Q

Standard input stream

A

System.in

63
Q

Standard error stream

A

System.err

64
Q

Java application uses an _________ to write data to a destination; it may be a file,
an array, peripheral device or socket.

A

Output stream

65
Q

Java application uses an ___________ to read data from a source; it may be a file, an
array, peripheral device or socket.

A

Input stream

66
Q

used to get user input,
and it is found in the java.util package.

A

Scanner class

67
Q

These are notes
written to a code
for documentation
purposes.

A

Java comments

68
Q

Three types of comments

A

Single line, multi line, documentation

69
Q

tokens that represent names of variables,
methods, classes, etc

A

Java identifiers

Note: they are case sensitive and must begin with a $, and they are case sensitive.

70
Q

predefined identifiers
reserved by Java for a
specific purpose.

A

Java keywords

71
Q

Tokens that do not change and are constant.

A

Java Literals

72
Q

Different types of Java literals:

A
  • Boolean
  • integer
  • floating-point
  • character
  • string
73
Q

It may come in different formats:
Decimal (base 8)
Hexadecimal (base 16)
Octal (base 8)

A

Integer literals

74
Q

It represents decimals with fractional parts, and can be expressed in scientific notation

A

Floating-point literals

75
Q

They have two values, true or false

A

Boolean

76
Q

Represent single Unicode characters.

A

Character literal

77
Q

Represent multiple characters and enclosed with quotation marks.

A

String literals

78
Q

The java programming language defines eight primitive data types which include:

A

Boolean, char, byte, short, int, long, double, float

79
Q

an item of data used to
store the state of objects.

A

Variable

80
Q

A variable has a ________ and ________

A

Data type, name

81
Q

indicates the type of
value that the variable can hold.

A

Data type

82
Q

Declaring a variable syntax

A

<data> <name> [= initial value];
</name></data>

83
Q

Two types of variables in java

A

Primitive and reference

84
Q

Stores data in the actual memory location where the variable is

A

Primitive variable

85
Q

Variables that store address in the memory location, points to another location

A

Reference variables

86
Q

What are the different types of operators

A

Arithmetic, relational, logical, conditional

87
Q

Compares two values and determines the relationship between the two values

A

Relational operators

88
Q

They have one or two Boolean operands that yield a Boolean result.

A

Logical operators

89
Q

A ternary operator that takes in three arguments

A

Conditional operator

90
Q

The structure of an expression using a conditional operator

A

exp1?exp2:exp3

91
Q

Evaluated from left to right

A

Compound condition

92
Q

It is a sequence of data. Composed of bytes. Used by java to make I/O operation fast.

A

Stream