Prelims Flashcards

(92 cards)

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
about writing procedures or methods that perform operations on the data,
Procedural programming
26
about creating objects that contain both data and methods.
Object oriented programming
27
Procedural programming has several advantages over object oriented programming
False
28
The problem solving phases
1. Analysis 2. General solution 3. Verify
29
Procedural programming Features
- top down design - limited code reuse - complex code - global data focused
30
Object oriented programming features
- object focused - code reuse - complex design - protected data
31
Advantages of OOP
- faster and easier to execute - provides clear structure for programs - helps keep the java code dry and easy to modify
32
What does DRY means
Don't repeat yourself
33
What is the basic unit of OOP
Class
34
Two main aspects of object oriented programming
Classes and objects
35
like an object constructor, or a “blueprint” for creating objects.
Class
36
The keyword for creating a new class
class
37
The keyword for creating a new object
new
38
To create a new object, you should:
specify the class name, followed by the object name, and use the keyword new
39
With objects and classes, You can use the existing class created.
True
40
Creating objects with classes process
Declaration, instantiation, initialization
41
OP languages permit higher level of abstraction for solving real-life problems.
True
42
An object oriented program consists of many well incapsulated objects
True
43
Benefits of OOP
Ease in software design, easy in maintenance, resuable software
44
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
Class
45
realization of a particular item of a class. In other words, an instance is an instantiation of a class
Instance
46
The term usually refers to
Instance
47
A Class is a 3-Compartment Box Encapsulating Data and Operations
True
48
identifies the class.
Name
49
contains the static attributes of the class
Variables
50
contains the dynamic behaviors of the class.
Methods
51
frequently instantiate objects that use the objects of other classes (and their data and methods). Sometimes you write classes that do both.
Application classes
52
The principle used in creating private access is sometimes called
Information hiding
53
_________ in Java is a mechanism to encapsulate a group of classes, sub packages and interface
Package
54
What are the uses of package
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
Two categories of packages in JAVA
Built in packages (from java API) And user defined packages
56
The library is divided into _______ and _________
Packages and classes
57
Syntax for importing a single class
import package.name.Class;
58
Syntax for importing a whole package
import package.name.*;
59
___________ is used to process the input and produce the output.
Java (I/O) input and output
60
contains all the classes required for input and output operations.
java.io package
61
Standard output stream
System.out
62
Standard input stream
System.in
63
Standard error stream
System.err
64
Java application uses an _________ to write data to a destination; it may be a file, an array, peripheral device or socket.
Output stream
65
Java application uses an ___________ to read data from a source; it may be a file, an array, peripheral device or socket.
Input stream
66
used to get user input, and it is found in the java.util package.
Scanner class
67
These are notes written to a code for documentation purposes.
Java comments
68
Three types of comments
Single line, multi line, documentation
69
tokens that represent names of variables, methods, classes, etc
Java identifiers Note: they are case sensitive and must begin with a $, and they are case sensitive.
70
predefined identifiers reserved by Java for a specific purpose.
Java keywords
71
Tokens that do not change and are constant.
Java Literals
72
Different types of Java literals:
- Boolean - integer - floating-point - character - string
73
It may come in different formats: Decimal (base 8) Hexadecimal (base 16) Octal (base 8)
Integer literals
74
It represents decimals with fractional parts, and can be expressed in scientific notation
Floating-point literals
75
They have two values, true or false
Boolean
76
Represent single Unicode characters.
Character literal
77
Represent multiple characters and enclosed with quotation marks.
String literals
78
The java programming language defines eight primitive data types which include:
Boolean, char, byte, short, int, long, double, float
79
an item of data used to store the state of objects.
Variable
80
A variable has a ________ and ________
Data type, name
81
indicates the type of value that the variable can hold.
Data type
82
Declaring a variable syntax
[= initial value];
83
Two types of variables in java
Primitive and reference
84
Stores data in the actual memory location where the variable is
Primitive variable
85
Variables that store address in the memory location, points to another location
Reference variables
86
What are the different types of operators
Arithmetic, relational, logical, conditional
87
Compares two values and determines the relationship between the two values
Relational operators
88
They have one or two Boolean operands that yield a Boolean result.
Logical operators
89
A ternary operator that takes in three arguments
Conditional operator
90
The structure of an expression using a conditional operator
exp1?exp2:exp3
91
Evaluated from left to right
Compound condition
92
It is a sequence of data. Composed of bytes. Used by java to make I/O operation fast.
Stream