Revature Interview questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is normalization?

A process which involves organizing the fields and tables of a database to eliminate data redundancy and Insertion, Update and Deletion Anomalies.

What are users vs schemas?

A schema is collection of database objects, including tables, views, sequences, stored procedures, etc. A user owns a schema.

What are the four pillars of oop?

Abstraction,Polymorphism, Encapsulation, Inheritance

What are the benefits of a stored procedure?

Better network efficiency since queries are stored on server. Makes code more maintainable, Better security, since we can restrict the ability to change or delete tables unless they use a stored procedure, C onsistency, since it forces all 3rd party programs who are querying data to use the business logic from the stored procedure.

What is CSS and how does it work?

Cascading style sheets. It styles the website by describing how the HTML elements are to be displayed.

What are checked and unchecked exceptions?

In Java exceptions under Error and RuntimeException classes are unchecked exceptions, everything else under throwable is checked Unchecked Exception in Java is those Exceptions whose handling is NOT verified during Compile time . These exceptions occurs because of bad programming

When using the padding property; are you allowed to use negative values?

No

What's the difference between a Set and a Map?

Set doesn't allow duplicates, while a map does, though it has unique keys.

type an object declaration

String mystring = new String();

What is abstraction?

The process of identifying only the required characteristics of an object ignoring the irrelevant details.The properties and behaviors of an object that differentiate it from other objects of similar type can also help in classifying/grouping the objects.

difference between union and unionall

UNION removes duplicate rows, while UNIONALL doesn't. UNIONALL is faster as a result.

Which CSS property is used to change the text color of an element?

color

How do you select all p elements inside a div element?

div p;

What is the javascript syntax to change an element of an HTML page?

document.getElementById("demo").innerHTML = "Hello World!";

What are the different HTMl elements

html, head, title, body

What is the syntax for creating a javascript array?

var colors = ["red", "green", "blue"];

How do you create a variable in JavaScript?

var number = 100;

Whats the difference between a == and === in javascript?

"===" checks to see if expressions are the same as well as being equal.

Write an array and an arraylist

// Array Example String[] arrayobj = new String[3]; arrayobj[0]= "Love yourself"; arrayobj[1]= "Alive is awesome"; arrayobj[2]= "Be in Present"; System.out.print("Array object output :"); for(int i=0; i < arrayobj.length ;i++) System.out.print(arrayobj[i] + " "); //Arraylist ArrayList<String> arrlistobj = new ArrayList<String>(); arrlistobj.add("Alive is awesome"); arrlistobj.add("Love yourself"); Iterator it = arrlistobj.iterator(); System.out.print("ArrayList object output :"); while(it.hasNext()) System.out.print(it.next() + " ");

What are the differences between an array and an arraylist?

1. Static size vs. Dynamic: An array is static in size, meaning you can't add to it once it has been created. An Arraylist is dynamic, meaning that each object in the Arraylist has an instance variable called capacity, which automatically expands as new objects are added. 2. Performance: Performance between the two is pretty similar, except when you are doing a resize() operation on the arraylist, where performance will suffer. 3. Primitive variables: An array can contain primitive values, while an arraylist can only contain objects. It converts the primitive value into its equivalent object, such as: ArrayList arraylistobject = new ArrayList(); arraylistobject.add(23); // try to add an int What actually happens: arraylistobject.add(new Integer(23)); 4. Iterating through values: An arraylist uses iterator to iterate through the objects in the arraylist, while an array uses a for or for each loop. 5. type safety: An array contains values of a specific data type such as a string array. If you try to add an int to that array an exception is thrown. 6.Length: To determine the size of an arraylist the size() method is used, while in an array the length variable is used. 7. Adding elements: An arraylist adds objects through the add() method, while an array simply uses an assignment operator. 8. Multi-dimensional: An array can be multi-dimensional while an arraylist can only be a single dimension.

What are the differences between abstract classes and interfaces?

1.Abstract classes can have abstract and concrete methods. Interfaces can only use abstract interfaces. 2.Variables in interfaces are by default final, abstract classes can contain non-final variables 3. Abstract classes can contain static, non-static, and final variables. Interfaces only have static and final variables. 4.Implementation: Abstract classes can provide the implementation of multiple interfaces, an interface can't provide implementation of an abstract class. 5.Inheritance vs. Abstraction: Interface can be implemented using key word implements, abstract classes can be extended using keyword extends. 6. An abstract class can only extend one class or abstract class at a time, an interface can extend any number of interfaces at a time. Abstract class: abstract class Example3 extends Example1{ abstract void display3(); } Interface: interface Example3 extends Example1,Example2{ 7. Interfaces are public by default, abstract classes can be private, static,etc.

How do you comment in HTML?

<!-- This is a single line comment -->

How can you open a link in a new tab/browser window?

<a href="url" target="_blank">

Name and explain some elements in HTML

<a> for creating hyperlinks, <br> to create a line break, <h1> to create a heading <div>used to divide the page <p> used to create a paragraph <article> to create independent self contained content from rest of page <header> used to define the header section <nav> used to define navigation area <footer> used to define footer Area.;

How do you change the background color?

<background-color>

How can you create a button in HTML?

<button type="button">My Button </button>

Which input type defines a slider control?

<input type="range">

What is the syntax for referring to an external style sheet?

<link rel="stylesheet" type="text/css" href="mystyle.css">

What is the box model?

A box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content.

What are abstract classes?

A class that is declared without an implementation and contain one or more abstract methods. Abstract classes may not be instantiated, and require sub-classes to provide implementations for the abstract methods.

What is object oriented programming?

A design philosophy based on objects which contain data in attributes and code in the form of methods. Objects are an instance of a class, which is a template for creating objects.

What is a stored procedure?

A set of SQL statements with an assigned name, which are stored in a relational database management system as a group, so it can be reused and shared by multiple programs.

what is a try, catch and what purpose does finally serve?

A try statement is used to catch exceptions that might be thrown as your program executes. You should use a try statement whenever you use a statement that might throw an exception A try block is always followed by a catch block, which handles the exception that occurs in the try block. A finally block contains all the crucial statements that must be executed whether an exception occurs or not.

What is a wireframe?

A visual guide that represents the skeletal framework of a website. Wireframes are created for the purpose of arranging elements to best accomplish a particular purpose.

What is the difference between encapsulation and abstraction?

Abstraction is about hiding unwanted details while giving out most essential details, while Encapsulation means hiding the code and data into a single unit e.g. class or method to protect inner working of an object from outside world.

Difference between INNER JOIN and OUTER JOIN

An inner join searches tables for matching or overlapping data. Upon finding it, the inner join combines and returns the information into one new table that contains only the matches from each table. An outer join returns a set of records (or rows) that include what an inner join would return but also includes other rows for which no corresponding match is found in the other table. Includes left outer join, which returns all records from the left table (table1), and the matched records from the right table (table2). The result is NULL from the right side, if there is no match. Also includes right outer join, which would include all records from the right table, and the matched records from the left table, even if there are null values. A full outer join joins all data from the two tables, even if there is no shared information.

What's the difference between a class and an interface?

An interface is a special type of construct in Java, which is used as a contract to guarantee implementation of certain behaviors in a subclass. an interface gives you method name but not the behavior of that method, which will come from the class which implements it. Since an interface is completely abstract you cannot create an object of them but a class can be both abstract and concrete hence you can create an object of a concrete class in Java.

What's the difference between an Array List and a Linked List and which is preferable?

Arraylist uses a dynamic array to store data, while linkedlist uses a double-linked list to store the elements. Adding or removing elements is slower in the arraylist because shifting all of the bits is required, unlike the linked list. Arraylist acts as a list only while linkedlist can act as a list and a queue. It depends on the situation, ArrayList is better for storing and accessing data, and LinkedList is better for manipulating data.

How do you link a style sheet to an html document?

By using the link element <link rel="stylesheet" type="text/css" href="css/style.css">

What is a Join? What is the difference between HAVING clause and WHERE clause?

Combines columns from two or more tables. The difference between the two is in the relationship to the GROUP BY clause: WHERE comes before GROUP BY; SQL evaluates the WHERE clause before it groups records. HAVING is used with aggregate functions after the GROUP BY statement.

What is DBMS?

Database management software. It allows users to create, read, update , and delete data in a database. It stores data in files. It consists of the data, the database engine that allows data to be accessed and modified,and the database schema, which defines the database's logical structure.

What is a getter/setter? What is their purpose?

Functions that modify private variables.

Why doesn't java support multiple inheritance?

It supports it, just through interfaces. It doesn't support multiple inheritance in order to avoid the complexity and conflicts that result. For example, if more than one superclass has the same base class then the subclass will receive 2 copies of the same attributes and methods, leading to ambiguity.

What is doctype used for?

It tells the browser what version of markup language is being used.

What is JVM, JRE?

Java virtual machine, java runtime environment

What do you use JavaScript for?

Javascript code is written into an HTML page, usually to make the website more interactive for users or to create online programs.

What is a list, set, and map? When should you use each?

List interface is a ordered collection that allows duplicate and null values. We can get elements by index. When there is a need to access elements frequently using the index, or when you want the elements stored to maintain the insertion order then use list. A Set is an unordered collection that won't allow duplicate elements. It allows null elements, but we can't get elements by key or index . When the collection should be of unique elements and no duplicates are tolerated, then go with "Set" . Map interface is a unordered collection that allows duplicate elements but not duplicate keys. It allows null elements but not null keys. When the data stored should be in the form of key and value then use map.

What does static mean in C# ?

Means that the variable belongs to the type itself and not to instances of the class. Used to create data and methods that can be accessed without creating an instance of the Class

What does static mean?

Means that the variable or function is shared between all instances of that class as it belongs to the type, not the actual objects themselves. So if you have a variable: private static int i = 0; and you increment it ( i++ ) in one instance, the change will be reflected in all instances.

What is MVC?

Model View Controller it consists of three parts" one that is the visual part that users interact with - the view, one that represents the object being modeled, and something that manages data between the different parts - the controller.

What is override and overload?

Override is when you use the same method in a subclass but modify or add to it, while overload is when you use the same method in a subclass but you have a different number or type of parameters.

What are selectors? List some

Patterns used to select the element you want to change. .class, #id, :visited.

What is RBDMS?

Relational Database Management Software. It stored data into columns and rows. SQL server is an example.

How do you select all tables in a database?

SELECT* FROM sys.Tables or SELECT*FROMinformation_schema.tables

What are the versions of SQL?

SQL-86 to SQL:2016

What are HTML form methods?

Specifies which http protocol should be used when submitting form data. The options are Get and Post.

Why is the main method static in java?

Static allows main() to be called before an object of the class has been created. This is necessary because main() is called by the JVM before any objects are made. Since it is static it can be directly invoked via the class.

What is difference between final and static?

Static means that there is only one copy of the variable in memory which is shared with all instances of the class, while final just means that the variable, method, or class can't be changed.

What does SQL stand for?

Structured Query Language

Which HTML element is used to display a scalar measurement within a range?

The <meter> element

What"s the difference between == and .equals()?

The == operator compares if the objects are referring to the same instance. The equals() operator compares the state of the objects (e.g. if all attributes are equal).

Who determines the standards for SQL?

The American National Standards Institute

what is the different between hashmap and hashtable?

The HashMap is non synchronized and permits nulls, whereas Hashtable is synchronized, which means Hashtable is thread-safe and can be shared between multiple threads, and doesn't allow nulls.

What is polymorphism?

The ability for an object to also be considered an instance of every object in its inheritance chain.For example, not only is USA Today an instance of a Magazine, it's also an instance of a Book, which is an instance of the Object class.Therefore, USA Today can be treated as a magazine, a book, or an object.

Tell me about a project you recently worked on?

The last major project i worked on was a website for a arts and crafts business. I had to create an ecommerce website from scratch without using a CMS or anything like that. I had to create a products page and link that through php to a mySQL database, and then display all of the products, along with the price and shipping. I then had to include the total price and integrate a third party credit card processor. I also had to create a new login portal for customers that would show recent orders, save credit card information, and allow them to change their information.

Do you know what multi-threading is? How do you do it (how would you start/stop a thread)?

The main purpose is to provide simultaneous execution of two or more parts of a program to maximize the CPU usage.A multithreaded program contains two or more parts that can run concurrently. . Thread thread = new Thread(); To start a thread: thread.start(); To stop a thread: Create a boolean variable flag and set it to true Create a method to stop the thread, which sets the variable to false. Use a while(flag) loop, and when you want to stop it call the stop thread method.

What is inheritance? What are the different types?

The mechanism by which one class inherits the attributes and methods of another class. Single Inheritance: A Subclass inherits methods and attributes from one superclass. Multilevel Inheritance: a derived class will be inheriting a base class and the derived class also acts as the base class for other class. Hierarchical Inheritance: Multiple subclasses inherit from one superclass. Multiple Inheritance: One class can inherit from more than one superclass. In java we must do this through interfaces. A subclass can only have one superclass Subclass doesn't inherit private fields or methods

What is an SQL trigger?

They are stored programs that are automatically executed in response to an event, such as inserting a new row in a table.

What is a wrapper class?

They convert primitive data types into objects. Objects are needed if we wish to modify the arguments passed into a method.

Why are strings immutable?

When a string is created and if the string already exists in the pool, the reference of the existing string will be returned, instead of creating a new object and returning its reference. If a string is mutable, changing the string with one reference will lead to the wrong value for the other references. It would also lead to security issues, since strings are often used in the parameters for database connections, opening a file, network connections, etc. If strings were mutable those values could be changed and it would be a security risk. It would also make hashmaps much less efficient, since they would have to check the hashcode every time it was used.

Can you overload a constructor?

Yes

Is Javascript case sensitive?

Yes

Can you have multiple catch blocks on a try statement?

Yes, but only the one that first matches the exception type is executed.

Can we overload or override static methods in java?

Yes, we can overload static methods by having the same method but with different parameters in the sub class. No, we can't override a static method because static methods are done at compile time while method overriding only occurs at runtime.

What is a constructor?

a block of code similar to a method that's called when an instance of an object is created.

What is a Jagged Array?

an array whose elements are arrays and can be different sizes.

Write a program which answers whether or not the input string is a palindrome.

class reverse { public static void main(String Args[]) { int number = 454; int temp = number; int reverse = 0; while(number > 0) { int lastNumber = number % 10; reverse = (reverse * 10) + lastNumber; number = number / 10; } if (reverse == temp) { System.out.println("Number is a palindrome"); } else { System.out.println("Number is not a palindrome"); } } }

What does finalize() do?

performed on object before object is destroyed to release non-java resources such as a file handle or database connection.

How do you create a new constructor?

public Actor(String first, String last) { firstName = first; lastName = last; } Actor a = new Actor("Arnold", " Schwarzenegger");

What code would you write for Java to find the product of two numbers without using the multiplication operator?

public class multiply { public static void main(String Args[]) { BufferedReader obj = new BufferedReader(new InputStreamReader((System.in))); System.out.println("Enter the first number"); int a= Integer.parseInt(obj.ReadLine()); System.out.println("Enter the second number"); int b=Integer.parseInt(obj.ReadLine()); int c=0; for(int i=0;i<b;i++) { c = a + c; } System.out.println("The product is " +c); } }

What are the different access modifiers?

public: anyone can access it private: visible only to the class. protected: accessible only in the package, and accessible outside of the package only through inheritance. default: available in the package.

What is casting?

taking an Object of one particular type and "turning it into" another Object type.

How do you make each word in a text start with a capital letter?

text-transform: capitalize;

What is the correct HTML for making a drop-down list?

the <select> element

What does it mean to have a "Normalized" database?

the process of organizing the columns (attributes) and tables (relations) of a relational database to reduce data redundancy and improve data integrity.


Kaugnay na mga set ng pag-aaral

Repaso del desgaste, la erosión y la deposición

View Set

Exam 4 - Chapters 11 and 12 - A&P

View Set

Chapter 9: Communication and the Therapeutic Relationship

View Set

Purchasing and Materials Management Final

View Set

Small Business Management Smart Book 3

View Set

Chapter 18 Feeding, Eating, and Elimination Disorders

View Set