Download Revature Technical Interview Questions and Answers
Updated Version/ Revature HR Interview and more Exams Computer Networks in PDF only on Docsity! Revature Technical Interview Questions and Answers Updated Version/ Revature HR Interview Questions Updated 2023-2024 What is normalization? --------- Correct Answer ---------- A process which involves organizing the fields and tables of a database to eliminate data redundancy and Insertion, Update and Deletion Anomalies. Why is the main method static in java? --------- Correct Answer ---------- 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 does static mean? --------- Correct Answer ---------- 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 are the four pillars of oop? --------- Correct Answer ---------- Abstraction,Polymorphism, Encapsulation, Inheritance What is object oriented programming? --------- Correct Answer ---------- 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 constructor? --------- Correct Answer ---------- a block of code similar to a method that's called when an instance of an object is created. How do you create a new constructor? --------- Correct Answer ---------- public Actor(String first, String last) { firstName = first; lastName = last; } Actor a = new Actor("Arnold", " Schwarzenegger"); What is inheritance? What are the different types? --------- Correct Answer ---------- 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 polymorphism? --------- Correct Answer ---------- 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. What are abstract classes? --------- Correct Answer ---------- 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 abstraction? --------- Correct Answer ---------- 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. What does finalize() do? --------- Correct Answer ---------- performed on object before object is destroyed to release non-java resources such as a file handle or database connection. What is difference between final and static? --------- Correct Answer ---------- 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 do you use JavaScript for? --------- Correct Answer ---------- Javascript code is written into an HTML page, usually to make the website more interactive for users or to create online programs. How do you create a variable in JavaScript? --------- Correct Answer ---------- var number = 100; What is a stored procedure? --------- Correct Answer ---------- 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 an SQL trigger? --------- Correct Answer ---------- They are stored programs that are automatically executed in response to an event, such as inserting a new row in a table. Name and explain some elements in HTML --------- Correct Answer ---------- <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.; Tell me about a project you recently worked on? --------- Correct Answer ---------- 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. What is DBMS? --------- Correct Answer ---------- 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 RBDMS? --------- Correct Answer ---------- Relational Database Management Software. It stored data into columns and rows. SQL server is an example. What does SQL stand for? --------- Correct Answer ---------- Structured Query Language Who determines the standards for SQL? --------- Correct Answer ---------- The American National Standards Institute What are the versions of SQL? --------- Correct Answer ---------- SQL-86 to SQL:2016 What are users vs schemas? --------- Correct Answer ---------- A schema is collection of database objects, including tables, views, sequences, stored procedures, etc. A user owns a schema. What is CSS and how does it work? --------- Correct Answer ---------- Cascading style sheets. It styles the website by describing how the HTML elements are to be displayed. How do you change the background color? --------- Correct Answer ---------- <background-color> What are the different HTMl elements --------- Correct Answer ---------- html, head, title, body What is doctype used for? --------- Correct Answer ---------- It tells the browser what version of markup language is being used. How can you create a button in HTML? --------- Correct Answer ---------- <button type="button">My Button </button> How do you comment in HTML? --------- Correct Answer ---------- <!-- This is a single line comment --> What is MVC? --------- Correct Answer ---------- 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 are selectors? List some --------- Correct Answer ---------- Patterns used to select the element you want to change. .class, #id, :visited. What is a wireframe? --------- Correct Answer ---------- 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 are HTML form methods? --------- Correct Answer ---------- Specifies which http protocol should be used when submitting form data. The options are Get and Post. What is the box model? --------- Correct Answer ---------- A box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content. How can you open a link in a new tab/browser window? --------- Correct Answer ---------- <a href="url" target="_blank"> What is the correct HTML for making a drop-down list? --------- Correct Answer ---------- the <select> element Which input type defines a slider control? --------- Correct Answer ---------- <input type="range"> Which HTML element is used to display a scalar measurement within a range? --------- Correct Answer ---------- The <meter> element What is the syntax for referring to an external style sheet? --------- Correct Answer -------- -- <link rel="stylesheet" type="text/css" href="mystyle.css"> Which CSS property is used to change the text color of an element? --------- Correct Answer ---------- color How do you make each word in a text start with a capital letter? --------- Correct Answer ---------- text-transform: capitalize; What is the javascript syntax to change an element of an HTML page? --------- Correct Answer ---------- document.getElementById("demo").innerHTML = "Hello World!"; When using the padding property; are you allowed to use negative values? --------- Correct Answer ---------- No How do you select all p elements inside a div element? --------- Correct Answer ---------- div p; What is the syntax for creating a javascript array? --------- Correct Answer ---------- var colors = ["red", "green", "blue"]; What is a list, set, and map? When should you use each? --------- Correct Answer -------- -- 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. Why doesn't java support multiple inheritance? --------- Correct Answer ---------- 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 What is JVM, JRE? --------- Correct Answer ---------- Java virtual machine, java runtime environment Asked to implement some simple methods in a language of your choices. Generating prime numbers, generating an alternating sequence of numbers, reverse a number. ----- ---- Correct Answer ---------- Write a program which answers whether or not the input string is a palindrome. --------- Correct Answer ---------- 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"s the difference between == and .equals()? --------- Correct Answer ---------- 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). What is casting? --------- Correct Answer ---------- taking an Object of one particular type and "turning it into" another Object type. what is the different between hashmap and hashtable? --------- Correct Answer ---------- 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 does it mean to have a "Normalized" database? --------- Correct Answer ---------- the process of organizing the columns (attributes) and tables (relations) of a relational database to reduce data redundancy and improve data integrity. What code would you write for Java to find the product of two numbers without using the multiplication operator? --------- Correct Answer ---------- 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 checked and unchecked exceptions? --------- Correct Answer ---------- 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 What are the differences between an array and an arraylist? --------- Correct Answer ----- ----- 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. Write an array and an arraylist --------- Correct Answer ---------- // 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() + " ");