Interview Questions

¡Supera tus tareas y exámenes ahora con Quizwiz!

Explain method overloading and method overriding. What are the differences?

(1) Method overloading is when you have 2 or more methods in the same class with the same name but different parameters. Overriding is when the child class implements a method differently from its parent class. (2) Method Overloading is when a " method" different forms. more precisely when two or more method have the same name but a different number of parameters and/or data types For Example, take a method name "addNumber" can accept two int type parameter or two float type parameters. addNumber(int a , int b) addNumber(float a, float b) Method Overriding is when a child class overrides the parent class method and implements its own instruction. Method Override requires inheritance while method loading happens in the same class.

How do you initialize and object (in C#)?

1) Declare a StudentName by using the constructor that has two parameters: StudentName student1 = new StudentName("Craig", "Playstead"); 2) Make the same declaration by using an object initializer and sending arguments for the first and last names. Here the paramterless constructor is invoked in processing this declaration, not the constructor that has two parameters. : StudentName student2 = new StudentName { FirstName = "Craig" LastName = "Playstead" };

Name three methods of the String class

1) String.Compare: Compares two specified String objects and returns an integer that indicates their relative position in the sort order. 2) String.Contains: Returns a value indicating whether a specified character occurs within this string, using the specified comparison rules. 3) String.Substring: Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string.

What is the difference between == and === in javascript

== compares value, whereas === compares values and type. For example 2 == '2' will return true but 2 === '2' will return false.

Can you describe Object Oriented Programming?

A computer programming model that organizes software design around data, or objects, rather than functions and logic. An object can be defined as a data field that has unique attributes and behavior.

What is a join and what are the different types?

A join is used to combined two or more table rows based on the related column between them ( generally use primary key ) There are four types Left Join --- fetch all of the rows from the left table and only matching rows from right Right Join -- fetch all of the rows from the right table and only match rows from left Inner join -- fetch only matched rows between them Outer Join -- fetch all the unmatched rows between the tables Left Outer join -- fetch all the unmatched rows from the left table Right Outer Join -- fetch all the unmatched rows from the right table

What is a Contstructor in C#?

A method that initializes a newly instantiated object.

What is JavaScript?

A programming language used for making a more dynamic layout for the webpage

What is a static method?

A static method belongs to the class rather than object of a class. A static method can be invoked without the need for creating an instance of a class. static method can access static data member and can change the value of it.

What is abstraction / abstract class?

Abstraction is the concept of hiding implementation details from the user and only showing functionality. An abstract class is a class that can not be instantiated but inherited from.

What is an array / arraylist? What are the differences?

An array stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type stored at contiguous memory locations. An ArrayList represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. However, unlike array you can add and remove items from a list at a specified position using an index and the array resizes itself automatically. It also allows dynamic memory allocation, adding, searching and sorting items in the list.

What is an exception? How do you handle it?

An exception is an event that occurs when the normal flow of the program is interrupted. It contains information about the error, state of the program, and other option values There are two types of exceptions Checked Exception: It can be handled using try and catch block or using throws keyword in the method's signature. uncheck exception may not be able to handle -- there could be runtime error or unexpected stack over flow (which can be handle but sometimes it doesn't make sense)

What is the difference between an Object and a Class?

An object is an instance of a class, a class is blueprint of an object.

What is the difference between an Array and an Arraylist?

Arrays have a fixed length and can store both objects and primitives, while Arraylists can only store objects and have a variable length.

What is the relationship between and object and a class?

Class is a blueprint of an object, it a template that is used to define its object state and behavior an object is an entity that has state and behavior in programming language object is an instance of the class.

While loop vs do-while loop

Contrast with the while loop, which tests the condition before the code within the block is executed, the do-while loop is an exit-condition loop. This means that the code must always be executed first and then the expression or test condition is evaluated. If it is true, the code executes the body of the loop again.

Name 5 tags in HTML!

Defines an image in an HTML page. - Tells the browser that this is an HTML document. - Element is a container for all the head elements. - Tag defines the document's body. - Is used for scrolling piece of text or image displayed either horizontally across or vertically down your web site page

What is a loop? list them

For loop, while loop, do...while loop loop is a programming structure that repeats a sequence of instructions until a specific condition is met or not met.

What is a foreign key, what is a primary key?

Foreign keys are used to create a relation between two tables (generally use the primary key from another table). Primary keys are used to uniquely identify a row in a table. it cannot be null

What previous projects do you have using software programs?

I have had courses at my university which required AutoCAD and MatLAB to create a PCB board, which will need soldered components to act as an active crossover

What is the difference between a stack and a queue?

In a stack, values are used based on Last in, first out basis. Queue, values are used based on first in, first out basis.

Difference between Abstraction & Interface?

Interfaces are the reference type that contains abstract methods. Basically, interfaces declare the behaviors, and class implements that behavior. Abstract Class are similar to regular classes except it cannot be initiated. it may or may not have an abstract method. one of the use-cases of the abstract class would be providing a base class that can be inherited. For Example. you want to create a class that will have some general method and some unique method. You should create an abstract class with a regular method and a unique method should be abstract so the sub-class can extend and implement its own implementation.

Why doesn't java support multiple inheritance?

It's to avoid the " diamond problem." Say you have 4 classes {A, B, C, D} where B and C inherit from A, and class D inherits from both B and C. If there is a method in A that both B and C have overridden-and D does not override it-then what version of the method does D inherit?

In a drop-off tournament with 10 teams, how many matches would the teams have to go through for one winner?

Let n = # of teams. in a drop of tournament, n-1 games are played to determine a winner, as each team has to lose once except the winning team.

What is a Setter?

Method that will set the value. Or a function that can modify private variables.

Is there a limit to the number of interfaces you can use?

No.

What is Normalization?

Normalization is a technique to reduce data redunacy in a databse by putting your databse in normal forms.

What is polymorphism?

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.

What is polymorphism and an example of polymorphism in code?

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. For example, think of a base class called Animal that has a method called animalSound(). Derived classes of Animals could be Pigs, Cats, Dogs, Birds - And they also have their own implementation of an animal sound (the pig oinks, and the cat meows, etc.):

What is SQL join?

Process of combining columns from two different tables based on matching stored data values as long as two or more columns have same column name.

How do you select a whole table in SQL?

SELECT * FROM "tablename";

What is a Set and a Map, and how are they different?

Set is a data structure that enforces a no duplicate value rule and the map is a data structure that uses key and value pair to store and organize data

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

Setter and Getters are functions that modify private variables. Setter is a public function that changes the value of a private variable. Getter is a public function that retrieves the value of a private variable. These are important for encapsulation.

What is the difference in WHERE and HAVING in SQL?

The difference between the having and where clause in SQL is that the where clause cannot be used with aggregates, but the having clause can.

What is the difference between a set and a list?

The main differences between sets and lists are that 1) a set cannot contain any duplicates, but a list can. 2) order - a list is an ordered list, but a set is an unordered list - the order is irrelevant.

What is the difference between a static variable and a final variable?

The static variable belongs to a class only ( a child class cannot inherit) the Final variable is a constant variable that cannot be changed but can be inherited

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

Use

How do you sum the numbers from 1 to n?

Use a loop

Is JavaScript case sensitive?

Yes.

What is the purpose of Cascade Style Sheets?

define style aspects of the webpage

what type of lists does html offer?

ol ordered list and ul unordered list

What's the difference between a primary key and a foreign key in SQL?

primary - a field in table used to uniquely identify a table (underlined) foreign - primary key used in second table as look-up field to identify records from the original table

how to retrieve data from a table using sql

select * from "table name" where "condition" join "for nested query" group by - optional order by - optional having - optional

What is inheritance?

when a new class is derived from an existing class.


Conjuntos de estudio relacionados

Political Science Test One Chapter 2

View Set

MGMT 490: Chapter 1 - Learnsmart, Activity and Quiz Questions

View Set

Hinkle PrepU Chapter 36: Management of Patients With Immune Deficiency Disorders

View Set

Select whether the dispute is verbal, factual, or some combination of the two. If verbal, select whether the dispute arises from vagueness or ambiguity.

View Set

Chapter 11: Enlightenment: Science and the New Learning

View Set

AZ-103-Exam-Dumps-AZ-103-Braindumps-AZ-103-VCE-AZ-103-PDF-Exam-Questions: from www.passleader.com

View Set

CompTIA Security+; Ch 2: Exploring Control Types and Methods

View Set

Chapter 3: Tax Formula and Tax Determination; An Overview of Property Transactions

View Set