general programming concepts and oop

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

How do you create a Class in Java?

1. The keyword "class" is used to create a class or right-click anywhere in the package explorer going new and selecting class. Make sure the source folder is correct then type the class name.

How do you create a constructor? Give an Example.

1. To create a constructor, you must use the same name as the class it resides in. It cannot be static, final, or abstract but it can have access modifiers. Ex. "Constructor(){---}" or "public Constructor(){-----}"

What is a default constructor?

The default constructor is a constructor that doesn't take in data, it simply initializes the data for the other constructors in the class to utilize

What is the syntax of "if" statements? "If...else" statements? "If...else if" statements?

1. "if" statement syntax in java is "if (Boolean expression) {code to execute}" with the condition being true then the code in the curly braces executes. "if else" will execute code after the "if else" statement when it's condition is true but the "if" statement condition is not. The "else" statement will execute code after it when all statements above it are not false.

What are the ways to handle an Exception?

1. "try", "catch", and "finally" keywords are used to handle exceptions.

What is the difference between var, let and const?

1. "var" declarations are globally or function scoped plus can be updated and re-declared. While "let" and "const" are block scoped. "let" can be updated but not re-declared. "const" cannot be updated or re-declared.

What is the 'Scanner' class used for?

1. 'Scanner' is a class used to obtain primitive and string inputs.

What is a class in Java?

1. A class in java is a blueprint from which objects are created. It represents the set of properties or methods that are common to all objects of one type.

What is a Compiled Language? Give an Example Compiled Language.

1. A complied language is a programming language that uses a complier. Before running code must be converted to a machine language mod from source code by the complier. Some examples are C and C++. They tend to be faster at run time.

What is a Constructor is Java?

1. A constructor is a type of method that is called when an object is created but it does not have a return type. It is used to initialize the object.

How do you create a Javascript Function?

1. A function in JavaScript is defined with the function keyword followed by the name, followed by parenthesis ().

What is a Map?

1. A map is collection of elements in key-value pairs.

What is a no-args constructor? Give an Example.

1. A no args constructor is a constructor with no arguments.

What is a parameterized constructor? Give an Example.

1. A parameterized constructor is a constructor with arguments (parameters).

What is a Scripting Language? Give an Example Scripting Language.

1. A scripting language is a programming language that uses scripts to make the execution of tasks automatic. Some examples are JavaScript and PHP

What is the difference between a Set, Queue and List?

1. A set is unordered so you can't access element position but you can add and remove elements. A queue is ordered so you can access element position but you can only add the end and remove from the head of the queue. A list is also ordered, you add an element to any position and manipulate elements in any position.

What is a Super Class?

1. A super class is a class that has other classes derived from it.

What is the difference between Alert, console.log and prompt?

1. Alert is popup that has a notice within it. Prompt is a popup with an input field, and console.log prints a message to the console.

What is an Array?

1. An array is a dynamically created object that is a container of elements of the same type.

How do you import a package in Java?

1. An import statement is used to import a package in Java

How do you import other packages and classes into a Class file?

1. An import statement is used to import other packages and classes into a class file.

What is an Attribute? Give at least 3 examples.

1. Attributes are used to modify html elements. Examples are: align, width, height, bgcolor, background

What is the DOM? What is DOM manipulation?

1. DOM (Document Object Model) is object-oriented representation of the web page.

What are 'Generics' used for? What is the syntax to use Generics?

1. Generics enable types (classes and interfaces) to be parameters when defining classes, interfaces, and methods. Use angle brackets for parameters followed by the methods return type

What does http stand for and what is it used for?

1. HTTP stands for hypertext transfer protocol. It is used to transfer data over the web.

What are Objects in Java?

1. In Java, an object is an instance of a class.

What is the JDK, JRE and JVM?

1. JDK stands for Java Development Kit (it is a software development kit that is used for Java). JRE stands for Java Runtime Environment (it is the software that runs Java programs). JVM stands for Java Virtual Machine (it is the software that converts the Java code into machine language.

What OOP Pillar are "Method Overriding" and "Method Overloading" most closely associated with?

1. Method overriding and overloading are most closely associated with polymorphism.

What is Object Oriented Programming (OOP)?

1. OOP (object oriented programming) is a way of programming that uses objects to contain data. Those objects are inside of classes.

What are the advantages of using Java?

1. Some advantages of using java are that it is platform independent and that it allows reusable code.

What are some benefits of using an IDE? What are some problems of using an IDE?

1. Some benefits of using an IDE are reduction in setup time, increased speed in development tasks, and standardizing the development process. Some drawbacks are that it may be too plex for beginners and that it takes time to learn.

What is the "Default" case?

1. The default case is what will execute if all other cases do not.

What is the difference between Collection and Collections?

1. The difference between Collection and Collections is that Collection is an interface and Collections is a class.

What is the difference between the GET and POST HTTP Methods?

1. The difference between GET and POST is that GET carries a request parameters in the URL string while POST carries the parameters in the message body.

What is the difference between "while", "do...while" and "for" loops?

1. The difference between a while, do while, and for loop is that both while and for loops will check the condition at the beginning but a do-while checks the condition at the end so it will always execute at least once.

What is the primary difference between an Exception and an Error?

1. The difference between an exception and error is that an error occurs at runtime and is unchecked while exceptions occur at both runtime and compile time.

What is the difference between Interfaces and Classes in Java?

1. The difference between an interface and a class is that an interface is fully abstract method so it can't be instantiated

What is the difference between Checked and Unchecked Exceptions

1. The difference between checked and unchecked exceptions is that checked exceptions is that checked exceptions occur at compile time while unchecked exceptions occur during runtime

What is the difference between a Method and a Constructor?

1. The differences between methods and constructors are the constructor is used to initialized objects and cannot have a return type but method is used to exhibit an objects functionality and is invoked explicitly.

What are the Primitive Datatypes in Java?

1. The primitive data types are: byte, int, short, char, float, long, double, boolean.

What is the syntax of Switch statements?

1. The syntax of a switch statement is Switch(expression){case value: statements; break; default;}

How do you create an Object in Java?

1. To create an object, you declare a variable with an object type then the new keyword is used to create an object followed by a call to a constructor.

What is a Wrapper Class? Autoboxing and Unboxing?

1. Wrapper classes are classes that wrap or contain an object. (turns a primitive into an object). Types are: Character, Byte, Short, Integer, Float, Double, Boolean. Auto-boxing and Unboxing is the automatic conversion that the Java compiler makes between the primitive types and object wrappers.

What does the "Finally" keyword do?

A finally code block can be placed after a try catch block. The code in the finally block will always run whether or not an exception is thrown.

What is a callback function?

A function written in a client script that runs asynchronously after a server call using getReference. Call back is defined as a parameter of the getReference

What is a Markup Language? Give an Example Markup Language.

A markup language is a programming language that uses tags to define elements in a document. Inside those tags are usually standard human readable words. Some examples are HTML and XML (extensible markup language)

What is an algorithm?

A set of well-defined logical steps that must be taken to perform a task.

What are the Access Modifiers in Java?

An access modifier is a statement used to specify which classes can have access to a given class and its contents

What is an Object in Javascript?

An object in JavaScript is an unordered collection of related data in the form of key value pairs

What is Binary?

Base 2. Binary uses characters (numbers) 0 and 1 only.

What are the Datatypes in Javascript?

Datatypes in JavaScript are: string, number, boolean, null, undefined, symbol, object, function, Date, Array, Object

What is Method Overriding?

If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding. It is used for runtime polymorphism and to provide the specific implementation of the method.

What is an IDE?

Integrated Development Environment Brings together all of the tools needed for a developer to write, debug and produce a program.

What is assembly language?

It is an alternative to machine language. Instead of using binary numbers for instructions, assembly language uses short words that are known as mnemonics.

What is JSON used for?

JSON (JavaScript Object Notation) is a lightweight format for storing and transferring data from a server to a web page

List some String Methods.

Some String methods are: concat(), copyValueOf(), split(), subString(), toLowerCase(), valueOf(), trim(), toString()

What is the difference between "if" and "switch" statements?

The difference between an if statement and a switch statement is that an if statement will execute only for the first condition that is true but the switch statement will execute everything until it comes to the end or a break(essentially an if statement select between tow alternatives while a switch statement selects among multiple alternatives)

What is HTML?

The file format for documents viewed using a browser, such as documents on the Web.

What is the first line of a .Java file?

The first line in a .java file is the package declaration

What are the Pillars of OOP?

The four pillars of OOP are Abstraction, Inheritance, Encapsulation, and Polymorphism

Describe the following Keywords in Java This New Super Static Final

a. "This" keyword is a reference variable that refers to the current object. b. "New" keyword is used to create an instance of a class. c. "Super" keyword is a reference variable for a parent class. d. "Static" keyword is a constant variable or method that is the same for all class instances e. "Final" keyword is for a variable, method, or class that can't be changed

Describe each Pillar of OOP with an Example for each.

a. Encapsulation is when objects are private inside a class and there is no direct access from one object to the other. Instead objects must be called with methods for intercommunication. b. Abstraction is a way of only revealing operations relevant for other objects to those objects and hiding all other implementation details. c. Inheritance is a way of simplifying code by reusing similar code logic thus creating parent- child relationships. Downstream or child classes can inherit from parent classes but not the reverse. d. Polymorphism of having different child classes inherit from a parent class but their own version a certain method so essentially it's as if a parent class made different copies of the same method for the child classes to inherit.

List some CSS properties and what they do.

a. align-items: Specifies the alignment for items inside a flexible container b. background-size: Specifies the size of the background image c. color: sets color of text d. height: Sets height of an element

What is JavaScript?

an object-oriented computer programming language commonly used to create interactive effects within web browsers.

What is CSS used for?

define style aspects of the webpage

What is the CSS box model?

is essentially boxes within boxes that wraps around HTML elements, and it consists of from outer box to inner box: margins, borders, padding, and the actual content.

How do you declare a variable in JavaScript?

var variableName;

!

! Logical complement

How do you assign a value to a Javascript Variable?

1. The equal to operator "=" is used to assign a value to a variable

What is the rule for changing primitive datatypes into other types? What is this called?

1. When changing primitives datatypes to other types the type must be the same and sub type to super type must be explicit. It is called type casting.

What is special about Strings in Java?

A string variable in java can be assigned without first calling constructor to create it

What is method overloading?

If a class has multiple methods by same name but different parameters, it is known as Method Overloading. It increases the readability of the program.

What is Java?

Platform independent programming language designed to run in a network environment


संबंधित स्टडी सेट्स

Psychology Exam II - Chapter 7 Review

View Set

Sociology 1304, Chapters 9, 10, 12

View Set

Chapter 11 Questions - Muscle Tissue

View Set

Chapter 30: Management of Patients with Hematologic Neoplasms

View Set

Digestive system disorder, chapter 11

View Set