• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/35

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

35 Cards in this Set

  • Front
  • Back

What is the difference between overriding and overloading?

Overriding is the concept of having one or more methods with the same name and parameters but different implementations. i.e. child overriding a parent or abstract class.




Overloading is the idea of having multiple functions or methods with the same name but different parameter and return signature.

What is a critical section?

A critical section is a piece of code that accesses a shared resource (data structure or device) that must not be concurrently accessed by more than one thread of execution. A critical section will usually terminate in fixed time, and a thread, task or process will have to wait a fixed time to enter it (aka bounded waiting). Some synchronization mechanism is required at the entry and exit of the critical section to ensure exclusive use, for example a semaphore.

What is the difference between a value type and a reference type?

Assignment - the primitive value is copied in primitive type where as in reference type the address is copied




Comparisons - the primitive values are compared in primitive type where as in reference type the addresses are compared to check if they point to same object.




Return - the primitive value is returned in primitive type where as in reference type the address is returned.

In terms of memory management, what is the stack, and what is the heap?

The heap stores Object types and the stack stores primitive value types (int, long, etc) as well as reference variables to objects in the heap.




1) Heap memory is used by all the parts of the application whereas stack memory is used only by one thread of execution.




2) Whenever an object is created, it’s always stored in the Heap space and stack memory contains the reference to it. Stack memory only contains local primitive variables and reference variables to objects in heap space.




3) Objects stored in the heap are globally accessible whereas stack memory can’t be accessed by other threads.




4) Memory management in stack is done in LIFO manner whereas it’s more complex in Heap memory because it’s used globally. Heap memory is divided into Young-Generation, Old-Generation etc, more details at Java Garbage Collection.




5) Stack memory is short-lived whereas heap memory lives from the start till the end of application execution.




6) We can use -Xms and -Xmx JVM option to define the startup size and maximum size of heap memory. We can use -Xss to define the stack memory size.




7) When stack memory is full, Java runtime throws java.lang.StackOverFlowError whereas if heap memory is full, it throws java.lang.OutOfMemoryError: Java Heap Space error.




8) Stack memory size is very less when compared to Heap memory. Because of simplicity in memory allocation (LIFO), stack memory is very fast when compared to heap memory.




http://www.journaldev.com/4098/java-heap-space-vs-stack-memory

In SQL, what is the difference between an inner join and a left join?

INNER JOIN: returns rows when there is a match in both tables.


LEFT JOIN: returns all rows from the left table, even if there are no matches in the right table.  



RIGHTJOIN: is the a left join flipped around


https://www.techonthenet.com/sql...

INNER JOIN: returns rows when there is a match in both tables.




LEFT JOIN: returns all rows from the left table, even if there are no matches in the right table.




RIGHTJOIN: is the a left join flipped around




https://www.techonthenet.com/sql/joins.php

What is a strongly typed programming language?

Definition




Strongly typed is a concept used to refer to a programming language that enforces strict restrictions on intermixing of values with differing data types. When such restrictions are violated and error (exception) occurs.




Explained




In strongly typed languages, the behavior of operations is more predictable compared to those of weakly typed languages. The downside is having to declare and type all variables and parameters -- though some would argue this is simply good coding.




The differentiation between strongly typed languages and weakly typed languages is somewhat blurry. Some of the languages considered strongly typed actually allow concessions that make them weakly typed. Take C#, for example. While C# requires all its variables to have a defined type, it allows the programmer to disable dynamic type checking. Even Java, considered one of the most strongly typed programming languages, allows objects to be cast to other types.




https://www.techopedia.com/definition/24434/strongly-typed

Describe the difference between valid and well-formed XML.

Well formed in relation to XML means that it has no syntax, spelling, punctuation, grammar errors, etc. in its markup. These kinds of errors can cause your XML document to not parse.




When you say an XML document is valid, you're saying that the element structure and markup of the XML document matches a defined standard of relationships, in addition to having well formed markup. In other words, is this XML document a quality document?




One standard used to validate XML is a DTD, or Document Type Declaration, although XML Schemas are also used.




https://www.ischool.utexas.edu/technology/tutorials/webdev/xml_dtds/04_xml.html

What is the relationship between threads and processes?

A process is an executing instance of an application. What does that mean? Well, for example, when you double-click the Microsoft Word icon, you start a process that runs Word.




A thread is a path of execution within a process. Also, a process can contain multiple threads. When you start Word, the operating system creates a process and begins executing the primary thread of that process.




In depth




It’s important to note that a thread can do anything a process can do. But since a process can consist of multiple threads, a thread could be considered a ‘lightweight’ process. Thus, the essential difference between a thread and a process is the work that each one is used to accomplish. Threads are used for small tasks, whereas processes are used for more ‘heavyweight’ tasks – basically the execution of applications.




Another difference between a thread and a process is that threads within the same process share the same address space, whereas different processes do not. This allows threads to read from and write to the same data structures and variables, and also facilitates communication between threads. Communication between processes – also known as IPC, or inter-process communication – is quite difficult and resource-intensive.




Each process has it’s own address space, but the threads within the same process share that address space. Threads also share any other resources within that process. This means that it’s very easy to share data amongst threads, but it’s also easy for the threads to step on each other, which can lead to bad things.




http://www.programmerinterview.com/index.php/operating-systems/thread-vs-process/

What does immutable mean?

Definition: unchanging over time or unable to be changed.




Java examples:


1) Declare the class as final so it can't be extended.


2) Make all fields private so that direct access is not allowed.


3) Don't provide setter methods for variables.


4) Make all mutable fields final so that it's value can be assigned only once.


5) Initialize all the fields via a constructor performing deep copy.


6) Perform cloning of objects in the getter methods to return a copy rather than returning the actual object reference.


7) Use Builder Pattern to easily create immutable classes




http://stackoverflow.com/questions/5124012/examples-of-immutable-classes#21369756

What is revision/version control?

Version control, also known as revision control or source control, is the management of changes to documents, computer programs, large web sites, and other collections of information.




Examples: Git, Subversion, and Mercurial

What does the V in MVC stand for, and what does it signify?

A view can be any output representation of information, such as a chart, diagram, webpage, or even command line.




The idea behind the view and indeed the Model and Controller is separation of concerns. This model serves as a guide rather than a hard truth because in practice there is no agreement between frameworks, libraries and applications on exactly how to apply MVC. Thus it is more of a guiding principle that allows you to change one part of an application with out changing all the other less related parts.




This is Aaron's definition, feel free to supplement or completely change based on your preferred definition.

What is the difference between a class and an object?

Many people get confused by the difference between class and object. The difference is simple and conceptual. A class is a template for objects. A class defines object properties including a valid range of values, and a default value. A class also describes object behavior. An object is a member or an "instance" of a class. An object has a state in which all of its properties have values that you either explicitly define or that are defined by default settings.




This subtle conceptual difference between classes and objects shows why there is a tendency to want to use them interchangeably.


http://www.ncl.ucar.edu/Document/HLUs/User_Guide/classes/classoview.shtml

Why would you ever want to create a mock object?

In order to isolate the boundaries of the application that is being tested and ensure that your tests are deterministic by controlling the side effects that would come from external dependencies. -Aaron




This is an Its like taking the car stereo out of the car and hooking it up to a test harness to test it in isolation. This means you don't have to turn on the car in order to test the radio. Testing it in the car is more like an end to end integration test.




----stack overflow-----


When unit testing, each test is designed to test a single object. However most objects in a system will have other objects that they interact with. Mock Objects are dummy implementations of these other objects, used to isolate the object under test.




The benefit of this is that any unit tests that fail generally isolate the problem to the object under test. In some cases the problem will be with the mock object, but those problems should be simpler to identify and fix.




http://stackoverflow.com/questions/1414032/why-create-mock-objects

What is unit testing?

A unit test involves the smallest testable part of an application like functions, classes, procedures, interfaces. Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.




The goal of unit testing is to segregate each part of the program and test that the individual parts are working correctly. Mocks and stubs are often used in unit testing to ensure this isolation.




http://istqbexamcertification.com/what-is-unit-testing/



Name and briefly describe three different kinds of testing that might be performed on an application before it is released to live.

Unit, Integration, Functional.


(There is also End to End and Integration)




Unit testing: testing of the smallest units of the application in isolation including methods, functions and classes.




Integration Testing: testing the correct behavior between two or more 'layers' or parts of your application.




Functional Testing: testing that from a user perspective everything in the system is functional and the features work. In web, this is usually done by simulating user clicks, events, and inputs and validating that the outcome is and behavior is correct.

What is the Liskov substitution principle?

The Liskov Substitution Principle (LSP, lsp) is a concept in Object Oriented Programming that states: Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.




Likov's Substitution Principle states that if a program module is using a Base class, then the reference to the Base class can be replaced with a Derived class without affecting the functionality of the program module.




Think of it like I can either receive (DI) this interface or the implementation class with out the actually knowing the difference.

What is test-driven development?

Test-driven development starts with developing test for each one of the features. The will likely fail as the tests are developed even before the the the actual code. The developer then develops and refactors the code to pass the test.




Two benefits of test driven development is that 1) the developer can leverage the IDE to quickly provide implementation stubs meaning faster development, and 2) ensures higher or near 100% test coverage. Caution, this does not guarantee that all the right behaviors are being tested.




https://www.tutorialspoint.com/software_testing_dictionary/test_driven_development.htm

What is the difference between iteration and recursion?

Iteration is incrementally progressing through a collection whereas recursion is a function or method repeatedly calling itself until some condition stop prevents further recursive calls.




Examples:




Iterating through a collection of patient names to display them to the screen.




Recursively traversing a folder structure to find a file by having a search method call itself repeatedly to retrieve a list of sub nodes until the file is found.

What is loose-coupling?

In computing and systems design a loosely coupled system is one in which each of its components has, or makes use of, little or no knowledge of the definitions of other separate components.




Coding to an interface is an example of loose coupling because although there is a dependency on the contract there is no dependency on the implementation nor the number of implementations.

Can you give a practical example of a recursive algorithm?

Recursively traversing a folder structure to list all contents by having a list contents method call itself repeatedly to list all sub nodes each node until all nodes/contents are listed.

In SQL, what’s the difference between a full join and an inner join?

A full Join returns all rows from the LEFT-hand table and RIGHT-hand table with NULL values in place where the join condition is not met.


INNER JOINS return all rows from multiple tables where the join condition is met.

A full Join returns all rows from the LEFT-hand table and RIGHT-hand table with NULL values in place where the join condition is not met.




INNER JOINS return all rows from multiple tables where the join condition is met.



What is time complexity?

Time complexity is a concept in computer science that deals with the quantification of the amount of time taken by a set of code or algorithm to process or run as a function of the amount of input.




Time complexity is expressed typically in the "big O notation," but there are other notations. This is a mathematical representation of the upper limit of the scaling factor for an algorithm and is written as O(Nn), with "N" being the number of inputs and "n" being the number of looping expressions.

What is an associative array?

An array of key to value pair associations or bindings that allow for lookup by a key. These can dictionaries dictionaries where the key becomes the word and the value becomes the definition.




one example of this is a hash map. Also in JavaScript (see also JSON), all objects behave as associative arrays with string-valued keys, while the Map and WeakMap types take arbitrary objects as keys.

What is a stateless system?

A stateless system can be seen as a black box where at any point in time the value of the output(s) depends only on the value of the input(s). Thus these types of systems are deterministic and can be thought of as pure functions. This has a great effect on improving performance of applications at scale.




Then the follow up question: What is a stateful system?




A stateful system instead can be seen as a box where at any point in time the value of the output(s) depends on the value of the input(s) and of an internal state, so basically a stateful system is like a state machine with "memory" as the same set of input(s) value can generate different output(s) depending on the previous input(s) received by the system. The reason this is not as easy to scale is that state must be communicated across multiple nodes when scaling.

What is the difference between an interface and an abstract class?

It’s best to start answering this question with a brief definition of abstract classes and interfaces and then explore the differences between the two.




Abstract Class:




A class must be declared abstract when it has one or more abstract methods. A method is declared abstract when it has a method heading, but no body – which means that an abstract method has no implementation code inside curly braces like normal methods do essentially just representing a contract.




You should also know that any non abstract class is called a concrete class.




Interface:




An interface differs from an abstract class because an interface is not a class. An interface is essentially a type that can be satisfied by any class that implements the interface.




it must have the phrase "implements " at the beginning of the class definition.




Side note:




It is usually better, depending on the situation, to favor composition over inheritance.




An implementation of composition over inheritance typically begins with the creation of various interfaces representing the behaviors that the system must exhibit. The use of interfaces allows this technique to support the Polymorphic behavior that is so valuable in object-oriented programming. Classes implementing the identified interfaces are built and added to business domain classes as needed. Thus, system behaviors are realized without inheritance.




Why?




Polymorphism does not necessarily imply inheritance. Often inheritance is used as an easy means to implement Polymorphic behavior, because it is convenient to classify similar behaving objects as having entirely common root structure and behavior. Think of all those car and dog code examples you've seen over the years.




But what about objects that aren't the same. Modelling a car and a planet would be very different, and yet both might want to implement Move() behaviour.




Common behavior can be provided through interfaces and a behavioral composite.




As to which is better, the answer is somewhat subjective, and really comes down to how you want your system to work, what makes sense both contextually and architecturally, and how easy it will be to test and maintain.

What is SQL injection?

SQL injection is a code injection technique, used to attack data-driven applications, in which nefarious SQL statements are inserted into an entry field, think a web form for first name, for execution (e.g. to dump the database contents to the attacker).




Follow up question: How to protect against it?




1) Constrain and sanitize input data. Check for known good data by validating for type, length, format, and range.




2) Use prepared statements and parameterized queries/procedures.




3) Use type-safe SQL parameters for data access




4) Use an account that has restricted permissions in the database.




5) Avoid disclosing database error information.




https://msdn.microsoft.com/en-us/library/ff648339.aspx

What is the result of 1 XOR 1?

The answer is 0 (false)



In order for the output to be true, only one of the inputs can be true. If both are true then it is no longer "exclusive".




http://www.programmerinterview.com/index.php/java-questions/xor-in-java/

What is a regular expression?

A regular expression (regex or regexp for short) is a special text string for describing a search pattern.




You are probably familiar with wildcard notations such as *.txt to find all text files in a file manager. The regex equivalent is ^.*\.txt$.




But you can do so much more: for example this is the regular expression to search for an email address: \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b




A good reference for learnding and testing regex http://regexr.com/ and https://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx

What is an undirected graph?

An undirected graph is graph, i.e., a set of objects (called vertices or nodes) that are connected together, where all the edges are bidirectional. An undirected graph is sometimes called an undirected network.

An undirected graph is graph, i.e., a set of objects (called vertices or nodes) that are connected together, where all the edges are bidirectional. An undirected graph is sometimes called an undirected network.

What are some important differences between a linked list and an array?

In array, each element is independent, no connection with previous element or with its location. In Linked list, location or address of elements is stored in the link part of previous element/node. In array, no pointers are used like linked list so no need of extra space in memory for pointer.

Why is code clarity important?

This is one of those questions that you have to answer from the heart...

Describe the Java Memory Model

1) Young Generation


-Eden space is a place where new objects are created. When the space is filled upto a certain percentage, GC is perfomed. This event is called as Minor GC. 


-The surviving objects from Eden space are moved to survivor space...

1) Young Generation




-Eden space is a place where new objects are created. When the space is filled upto a certain percentage, GC is perfomed. This event is called as Minor GC.




-The surviving objects from Eden space are moved to survivor spaces(S0 & S1).




-Minor GC checks the object in survivor spaces and move to other survivor spaces (S0->S1).




-Objects surviving mutiple minor GC are moved to old generation.




2) Old Generation




Objects survived multiple minor GC are moved to old generation. When an old generation is full, the major GC takes place to remove the unused objects. This event can cause a minor pause in the working of application. Too many frequent major GC can trigger performance issue in the application. While designing an application, one should be considerate about it.




3) Perm Gen (Note: Perm Gen is not available in Java 8 anymore)




Perm Gen contains the metadata of the classes. i.e. Methods of a class, Names of the classes, Constant pool(e.g String pool), Object arrays and type arrays associated with a class , and Internal objects created by the JVM.




http://www.journaldev.com/2856/java-jvm-memory-model-memory-management-in-java




http://java-questions.com/java-memory-model-and-garbage-collections.html



































When does an object becomes eligible for GC?

1) When a object is not referred by other objects or all its references are set to null.


2) Object moves out of the scope.


3) Weak reference objects, such as WeakHashMap




http://java-questions.com/java-memory-model-and-garbage-collections.html

What’s the difference between white and black box testing?

Black-box testing is a way of testing software without having much knowledge of the internal workings of the software itself. Black box testing is often referred to as behavioral testing, in the sense that you want to test how the software behaves as a whole. It is usually done with the actual users of the software in mind, who usually have no knowledge of the actual code itself.




White box (aka clear box), on the other hand, is testing of the structural internals of the code – it gets down to the for loops, if statements, etc. It allows one to peek inside the ‘box’. Tasks that are typical of white box testing include boundary tests, use of assertions, and logging.




http://www.programmerinterview.com/index.php/general-miscellaneous/black-vs-white-box-testing/

What is a partial class, and what is a key benefit of a partial class?

The concept of partial class is your class can stay into two separate physical files but when they compile, they compile into one DLL unit.




(This is a C# Microsoft thing, Java doesn't do this)




https://www.codeproject.com/Articles/819841/Why-Microsoft-has-partial-classes-and-Java-does-no