Bangladesh Development Bank - Senior Officer- IT, 2017
Question: Discuss Architecture of Java Virtual Machine?
JVM (Java Virtual Machine) is an abstract machine. It is a
specification that provides runtime environment in which java bytecode can be
executed.
JVMs are
available for many hardware and software platforms (i.e. JVM is platform
dependent).
JVM Architecture
1) Classloader
Classloader
is a subsystem of JVM which is used to load class files. Whenever we run the
java program, it is loaded first by the classloader. There are three built-in
classloaders in Java.
·
Bootstrap ClassLoader
- Extension
ClassLoader
- System/Application
ClassLoader
2) Class(Method) Area
Class(Method)
Area stores per-class structures such as the runtime constant pool, field and
method data, the code for methods.
3) Heap
It is
the runtime data area in which objects are allocated.
4) Stack
Java
Stack stores frames. It holds local variables and partial results, and plays a
part in method invocation and return.
5) Program Counter
Register
PC
(program counter) register contains the address of the Java virtual machine
instruction currently being executed.
6) Native Method Stack
It
contains all the native methods used in the application.
7) Execution Engine
It
contains:
- A virtual processor
- Interpreter: Read bytecode stream then execute the
instructions.
- Just-In-Time(JIT) compiler: It is used to improve
the performance. JIT compiles parts of the byte code that have similar
functionality at the same time, and hence reduces the amount of time
needed for compilation.
8) Java Native Interface
Java
Native Interface (JNI) is a framework which provides an interface to
communicate with another application written in another language like C, C++,
Assembly etc. Java uses JNI framework to send output to the Console or interact
2. Question: A program sorts an array of integers. Write down the code that tests the sorting algorithm of written in program.
Let , data are in ascending orderbool Sort_check(int ar[])
{
for (int i = (ar.length - 1); i >= 0; i--)
{
for (int j = 1; j ≤ i; j++)
{
if (ar[j-1] > ar[j])
{
return false;
}
}
}
return true;
}
3. Write
a program using any programming language that reads five numbers from keyboard
and display the smaller, larger and average of those numbers.
Solution given in C++
#include<iostream>
using namespace std;
int main()
{
int a[5],max,min, sum=0;
float avg;
for(int i=0;i<5;i++)
{
cin>>a[i];
}
max=min = a[0];
for (int i=1;i<5;i++)
{
sum=sum+a[i];
if(a[i]>max)
max=a[i];
else if(min>a[i])
min =a[i] ;
}
avg=sum/5;
cout<<max<<endl<<min<<endl<<avg<<endl;
return 0;
}
4. Question: Write down the name of different attack through internet.
different attack
through internet below:
Malware – short for malicious software which is specifically designed to disrupt, damage, or gain authorized access to a computer system. Much of the malware out there today is self-replicating: once it infects one host, from that host it seeks entry into other hosts over the Internet, and from the newly infected hosts, it seeks entry into yet more hosts. In this manner, self-replicating malware can spread exponentially fast.
Virus – A malware which requires some form of user’s interaction to
infect the user’s device. The classic example is an e-mail attachment
containing malicious executable code. If a user receives and opens such an
attachment, the user inadvertently runs the malware on the device.
Worm – A malware which can enter a device without any explicit user
interaction. For example, a user may be running a vulnerable network
application to which an attacker can send malware. In some cases, without any
user intervention, the application may accept the malware from the Internet and
run it, creating a worm.
Botnet – A network of private computers infected with malicious software
and controlled as a group without the owners’ knowledge, e.g. to send spam.
DoS (Denial of Service) – A DoS attack renders a network, host, or other pieces of
infrastructure unusable by legitimate users. Most Internet DoS attacks fall
into one of three categories :
• Vulnerability attack: This involves sending a few well-crafted messages to a vulnerable
application or operating system running on a targeted host. If the right
sequence of packets is sent to a vulnerable application or operating system,
the service can stop or, worse, the host can crash.
• Bandwidth flooding: The attacker sends a deluge of packets to the targeted host—so
many packets that the target’s access link becomes clogged, preventing
legitimate packets from reaching the server.
• Connection flooding: The attacker establishes a large number of half-open or fully
open TCP connections at the target host. The host can become so bogged down
with these bogus connections that it stops accepting legitimate connections.
DDoS (Distributed DoS) – DDoS is a type of DOS attack where multiple compromised systems,
are used to target a single system causing a Denial of Service (DoS) attack.
DDoS attacks leveraging botnets with thousands of comprised hosts are a common
occurrence today. DDoS attacks are much harder to detect and defend against
than a DoS attack from a single host.
Packet sniffer – A passive receiver that records a copy of every packet that flies
by is called a packet sniffer. By placing a passive receiver in the vicinity of
the wireless transmitter, that receiver can obtain a copy of every packet that
is transmitted! These packets can contain all kinds of sensitive information,
including passwords, social security numbers, trade secrets, and private
personal messages. some of the best defenses against packet sniffing involve
cryptography.
IP Spoofing – The ability to inject packets into the Internet with a false
source address is known as IP spoofing, and is but one of many ways in which
one user can masquerade as another user. To solve this problem, we will need
end-point authentication, that is, a mechanism that will allow us to determine
with certainty if a message originates from where we think it does.
Man-in-the-Middle Attack – As the name indicates, a
man-in-the-middle attack occurs when someone between you and the person with
whom you are communicating is actively monitoring, capturing, and controlling
your communication transparently. For example, the attacker can re-route a data
exchange. When computers are communicating at low levels of the network layer,
the computers might not be able to determine with whom they are exchanging
data.
Compromised-Key Attack – A key is a secret code or number necessary to interpret secured
information. Although obtaining a key is a difficult and resource-intensive
process for an attacker, it is possible. After an attacker obtains a key, that
key is referred to as a compromised key. An attacker uses the compromised key
to gain access to a secured communication without the sender or receiver being
aware of the attack.
Phishing – The fraudulent practice of sending emails purporting to be from
reputable companies in order to induce individuals to reveal personal
information, such as passwords and credit card numbers.
DNS spoofing – Also referred to as DNS cache poisoning, is a form of computer security hacking in which corrupt Domain Name System data is introduced into the DNS resolver’s cache, causing the name server to return an incorrect IP address.
5. Question: Describe the ACID properties of Database.
ACID Properties in DBMS
·
Atomicity
By this, we mean that either the entire
transaction takes place at once or doesn’t happen at all. There is no midway
i.e. transactions do not occur partially. Each transaction is considered as one
unit and either runs to completion or is not executed at all. It involves the
following two operations.
—Abort: If a
transaction aborts, changes made to database are not visible.
—Commit: If a
transaction commits, changes made are visible.
Atomicity is also known as the ‘All or nothing
rule’.
·
Consistency: This means that integrity constraints must be maintained so
that the database is consistent before and after the transaction. It refers to
the correctness of a database. Referring to the example above,
The total amount before and after the transaction
must be maintained.
Total before T occurs
= 500 + 200 = 700.
Total after T occurs = 400 + 300 = 700.
Therefore, database is consistent. Inconsistency occurs in case T1 completes but T2 fails. As a result T is incomplete.
·
Isolation: For every pair of transactions, one transaction should start
execution only when the other finished execution. I have already discussed the
example of Isolation in the Consistency property above.
· Durability: Once a transaction completes successfully, the changes it has made into the database should be permanent even if there is a system failure. The recovery-management component of database systems ensures the durability of transaction.
6. Question: What is HTML Canvas? Differentiate between canvas and SVG.
Canvas
A canvas is a rectangular area on an HTML page.
By default, a canvas has no border and no content. Note:
Always specify an id attribute (to be referred to in a script), and a width and
height attribute to define the size of the canvas. To add a border,
use the style attribute.
Differences between SVG and Canvas
The HTML5
introduced the two new graphical elements <canvas>
and <svg>
for creating rich graphics on the
web, but they are fundamentally different.
The
following table summarizes some of the basic differences between these two
elements, which will help you to understand how to use these elements
effectively and appropriately.
SVG |
Canvas |
Vector based (composed of shapes) |
Raster based (composed of pixel) |
Multiple graphical elements, which become the part of the
page's DOM tree |
Single element similar to |
Modified through script and CSS |
Modified through script only |
Good text rendering capabilities |
Poor text rendering capabilities |
Give better performance with smaller number of objects or
larger surface, or both |
Give better performance with larger number of objects or
smaller surface, or both |
Better scalability. Can be printed with high quality at any
resolution. Pixelation does not occur |
Poor scalability. Not suitable for printing on higher
resolution. Pixelation may occur |
7. Question: What
is garbage collection? Write down the difference between garbage collection
in.NET 4 and earlier version of.NET.
Garbage collection prevents memory leaks during execution of programs. Garbage collector is a low-priority process that manages the allocation and deallocation of memory for your application. It checks for the unreferenced variables and objects. If GC finds any object that is no longer used by the application, it frees up the memory from that object.
GC has changed a bit with the introduction of .NET 4.0. In .NET 4.0, the GC.Collect() method contains the following overloaded methods:
GC.Collect(int)
GC.Collect(int, GCCollectionMode)
Another new
feature introduced in .NET is to notify you when the GC.Collect() method is
invoked and completed successfully by using different methods. The .NET 4.0
supports a new background garbage collection that replaces the concurrent
garbage collection used in earlier versions. This concurrent GC allocates
memory while running and uses current segment (which is 16 MB on a workstation)
for that. After that, all threads are suspended. In case of background GC, a
separate ephemeral GC - gen0 and gen1 can be started, while the full GC - gen0,
1, and 2 - is already running.
0 মন্তব্যসমূহ