Revature qc

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

When to create static variables?

1)when you want a variable that always has the same value for every object in the class 2)when you have a method that does not use any instance variables.

What is the difference between Array list and vector in Java?

1.Synchronization :Vector is synchronized, which means only one thread at a time can access the code, while arrayList is not synchronized, which means multiple threads can work on arrayList at the same time. 2.Performance: ArrayList is faster, since it is non-synchronized, while vector operations give slower performance since they are synchronized 3.Data Growth:ArrayList increments 50% of the current array size if the number of elements exceeds its capacity, while vector increments 100% - essentially doubling the current array size. 4.Traversal:Vector can use both Enumeration and Iterator for traversing over elements of vector while ArrayList can only use Iterator for traversing.

How to do you check for exceptions in Junit?

@Test annotation to declare that we expect an exception to be thrown anywhere in the annotated test method

What is Package Manager?

A package manager is a programming language's tool to create project environments and easily import external dependencies.

What is Security Group?

A security group acts as a virtual firewall for your EC2 instances to control incoming and outgoing traffic. Inbound rules control the incoming traffic to your instance, and outbound rules control the outgoing traffic from your instance.

What is difference between Class and object?

Class is the blueprint in which your object will be created from, and an object is an instance of that class.

What is collection?

Collection is the interface where you group objects into a single unit.

What is difference between Comparable and Comparator?

Comparable in Java is an object to compare itself with another object. It helps to sort the list of custom objects. Comparator in Java is an object for comparing different objects of different classes. Comparator interface in Java is also used to arrange the objects of user-defined classes.

What are properties of OOPs?

Encapsulation, Abstraction, Inheritance, and Polymorphism.

What is Hasmap?

HashMap stores items as key/value pairs. Values can be accessed by indexes, known as keys, of a user-defined type. Java HashMap class implements the map interface by using a hash table. Maps are unsorted and unordered HashMap doesn't allow duplicate keys but allows duplicate values. HashMap allows null key also but only once and multiple null values. This class makes no guarantees as to the order of the map

How Hashmap stores key and value pair?

It stores the data in (Key, Value) pairs, and you can access them by an index of another type (e.g. an Integer)

Explain JDK, JRE and JVM?

JDK:is Kit which provides the environment to develop and execute(run) the Java program. JDK is a kit(or package) which includes two things: 1.Development Tools(to provide an environment to develop your java programs) 2.JRE (to execute your java program). JRE:is an installation package which provides environment to only run(not develop) the java program(or application)onto your machine. JRE is only used by them who only wants to run the Java Programs i.e. end users of your system. JVM:is a very important part of both JDK and JRE because it is contained both. Whatever Java program you run using JRE or JDK goes into JVM and JVM is responsible for executing the java program line by line hence it is also known as interpreter.

Why Java is not 100% Object-oriented?

Java is not fully object oriented because it supports primitive data type like it,byte,long etc.,which are not objects. Because in JAVA we use data types like int, float, double etc which are not object oriented.

How Logging is significant?

Recording unusual circumstances or errors that may be happening in the program Getting the info about whats going in the application Basically, logging helps us create better and more efficient code by tracking what is going on in the code

What is the hashCode()?

The hashcode of a Java Object is simply a number, it is 32-bit signed int, that allows an object to be managed by a hash-based data structure.

What are the differences between Heap and Stack Memory in Java?

The major difference between Stack memory and heap memory is that the stack is used to store the order of method execution and local variables while the heap memory stores the objects and it uses dynamic memory allocation and deallocation.

What is use of Super keyword?

The super keyword refers to superclass (parent) objects. It is used to call superclass methods, and to access the superclass constructor. The most common use of the super keyword is to eliminate the confusion between superclasses and subclasses that have methods with the same name.

Explain public static void main(String args[]) in Java?

Public- it is access specifier from anywhere we can access it Static- it is access modifier we can call the methods directly by class name without creating its objects Void- it is the return type Main- it is a method name String[]args- in java we accept only the string type of argument and store it

What are wrapper classes in Java?

Wrapper class provides the mechanism to convert primitive data types into object and object into primitive. In Java, you can use Integer, Float etc. instead of int, float etc. We can communicate with objects without calling their methods

What is singleton class in Java and how can we make a class singleton?

a singleton class is a class that can have only one object (an instance of the class) at a time. To design a singleton class: 1.Make constructor as private. 2.Write a static method that has return type object of this singleton class. Here, the concept of Lazy initialization is used to write this static method.

What does the assertEquals() to do?

assertEquals() methods checks that the two objects are equals or not. If they are not, an AssertionError without a message is thrown. Incase if both expected and actual values are null, then this method returns equal. Checks that two primitives/objects are equal.

What is garbage collection?

is a process by which the programs perform memory management automatically. The Garbage Collector(GC) finds the unused objects and deletes them to reclaim the memory. In other words, it is a way to destroy the unused objects.

What is Operating System?

is a software that acts as an interface between computer hardware components and the user.

What are constructors in Java?

is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes

What is String Pool?

is nothing but a storage area in Java heap where string literals stores.

Why Java is platform independent?

it is independent is that the java compiled code(byte code) can run on all operating systems.(meaning it does not depend on any type of platform.)

What is Logging?

logging is an important feature that helps developers to trace out the errors.

What is difference between Multithreading, MultiTasking?

multitasking, the processes share separate memory. While in multithreading, processes are allocated same memory to the processes for execution

What are static members?

static members are those which belongs to the class and you can access these members without instantiating the class.

What is TDD?

test cases are written before the code underlying those test cases is written.

What is difference between Instance variable and local variable?

Instance variables are variables within a class but outside any method. These variables are instantiated when the class is loaded. Local variables are declared within a method. Instance variables are declared inside a class but not within a method.

How Arraylist is different form linked list?

Internal Implementation: ArrayList internally uses a dynamic array to store its elements. LinkedList uses Doubly Linked List to store its elements. Manipulation: ArrayList is slow as array manipulation is slower. LinkedList is faster being node based as not much bit shifting required. Implementation: ArrayList implements only List. LinkedList implements List as well as Queue. It can acts as a queue as well. Access: ArrayList is faster in storing and accessing data.LinkedList is faster in manipulation of data.

What do you mean by a testing framework?

A testing framework is a set of guidelines or rules used for creating and designing test cases. A framework is comprised of a combination of practices and tools that are designed to help to test more efficiently.

What is Thread?

A thread is a single sequential flow of control within a program.

What is different access modifiers and non access modifiers?

Access modifiers: helps to restrict the scope of a class, constructor, variable, method, or data member. Non-Access modifiers: They are used with classes, methods, variables, constructors etc to provide information about their behavior

What is EC2 ?

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster.

How will you define the AMI?

An Amazon Machine Image (AMI) provides the information required to launch an instance. You must specify an AMI when you launch an instance.

What is difference between Iterator and ListIterator?

An Iterator is an interface in Java and we can traverse the elements of a list in a forward direction whereas a ListIterator is an interface that extends the Iterator interface and we can traverse the elements in both forward and backward directions

What is the difference between equals() and == in Java?

In simple words, == checks if both objects point to the same memory location whereas .equals() evaluates to the comparison of values in the objects.

In how many ways you can create object of thread?

One is to declare a class to be a subclass of Thread; The other way to create a thread is to declare a class that implements the Runnable interface

What is difference between StringBuffer and String Builder?

StringBuilder and StringBuffer are almost the same. The difference is that StringBuffer is synchronized and StringBuilder is not. Although, StringBuilder is faster than StringBuffer, the difference in performance is very little.

Explain the architecture of Unix?

The architecture of Unix is divided into kernel, hardware, shell, files and directories in which the kernel manages the connections related to hardware, applications and commands. While the second layer is hardware and the third layer called shell is the bridge between the user, commands executed by the user and the commands in Unix that are already predefined and the last layer is files and directories which are called Unix programs mostly and can be considered as commands in Unix.


Set pelajaran terkait

Cell bio lecture 14: Endomembrane System

View Set

Chapter 2 - Supply Chain Performance: Achieving Strategic Fit and Scope

View Set

Bill of Rights - First 10 Amendments of the Constitution

View Set

Study Guide - Unit 3 (English Civil War and Glorious Revolution)

View Set

MGMT 3140-H01: Chapter 11. Managing the Diverse Workforce

View Set

Last min Grammar - Study Sections

View Set

Managing Human Resources Chapter 9 Managing Compensation

View Set