Typescript

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

Explain advantages/disadvantages of SQL and NoSQL

1. SQL databases are relational, NoSQL are non-relational. 2. SQL databases use structured query language and have a predefined schema. NoSQL databases have dynamic schemas for unstructured data. 3. SQL databases are vertically scalable, NoSQL databases are horizontally scalable. 4. SQL databases are table based, while NoSQL databases are document, key-value, graph or wide-column stores. 5. SQL databases are better for multi-row transactions, NoSQL are better for unstructured data like documents or JSON.

What are access modifiers? Name and explain the one's in Java.

A Java access modifier specifies which classes can access a given class and its fields, constructors and methods. ---- default (package): code inside the class itself as well as code inside classes in the same package as this class, can access the class, field, constructor or method which the default access modifier is assigned to -- public: all code can access the class, field, constructor or method, regardless of where the accessing code is located. The accessing code can be in a different class and different package. -- private: only code inside the same class can access the variable, or call the method -- protected: same access as the default access modifier, with the addition that subclasses can access protected methods and member variables (fields) of the superclass. This is true even if the subclass is not located in the same package as the superclass.

What are generics?

Generics allow you to delay the specification of the data type of programming elements in a class or a method, until it is actually used in the program. In other words, generics allow you to write a class or method that can work with any data type. You write the specifications for the class or the method, with substitute parameters for data types. When the compiler encounters a constructor for the class or a function call for the method, it generates code to handle the specific data type. It helps you to maximize code reuse, type safety, and performance.

What are the 4 building blocks of OOP?

Inheritance, abstraction, polymorphism, encapsulation

What is the difference between method overriding and method overloading?

Overloading: When two or more methods in the same class have the same name but different parameters Overriding: When the method signature (name and parameters) are the same in the superclass and the child class -- 1. Overriding implements Runtime Polymorphism whereas Overloading implements Compile time polymorphism. 2. The method Overriding occurs between superclass and subclass. Overloading occurs between the methods in the same class. 3. Overriding methods have the same signature i.e. same name and method arguments. Overloaded method names are the same but the parameters are different. 4. With Overloading, the method to call is determined at the compile-time. With overriding, the method call is determined at the runtime based on the object type. If overriding breaks, it can cause serious issues in our program because the effect will be visible at runtime. 5. Whereas if overloading breaks, the compile-time error will come and it's easy to fix.

What is static polymorphism?

Synonymous to method overloading, It is when you implement multiple methods within the same class that use the same name but a different set of parameters.

SQL: Truncate VS delete

Truncate is like a super delete. Truncate removes all data from the table and only provides one entry to the transaction/write ahead log. Delete allows for the where conditional, allows for transactional roll backs, and writes an entry for each row deleted into the write ahead logs.

What is the purpose of the tsconfig.json file?

TypeScript compiler uses tsconfig.json to get configuration options for generating JavaScript code from TypeScript sourcecode.

Typescript: What is the difference between an interface and a type alias?

With type aliases, we can create a new name for a type but we don't define a new type. Interfaces are basically a way to describe data shapes, for example, an object. Type is a definition of a type of data, for example, a union, primitive, intersection, tuple, or any other type. Interface work better with objects and method objects, and types are better to work with functions, complex types, etc. https://blog.logrocket.com/types-vs-interfaces-in-typescript/

HIRED: Users are complaining that your API responds slowly. Which of these is a valid optimization that could feasibly speed up your response time?

a. Add additional indices to underlying database queries b. Cache the response for all possible create, read, update, and delete requests c. Use a geographically-clustered content delivery network to get servers close to one another d. Select a faster hashing algorithm for authentication credentials

HIRED: You are using a phone table to store a phone directory. You have a table, DIRECTORY, which contains columns (NAME, ADDRESS, PHONE_NUMBER). You want to be able to reverse phone number look ups. That is, given a phone number, find the name of the person it belongs to. You want to add an index to speed up these look ups, and your database has many different types. Which index type would most improve the look up time? Assume that phone numbers in the database are already clean and normalized.

a. Any - All indexes will have the same performance b. BTREE c. None- An index won't help here d. HASH

HIRED: When is it a good idea to include authentication credentials in a request's query parameters?

a. For PUT and POST requests b. For any request type c. Only when using HTTPS d. This is never a good idea

HIRED: You are playing a very long video form a 500GB file in a continuous loop on a screen. The screen only has 1G of memory. Which page replacement policy would work best?

a. LRU b. FIFO c. They all preform equally well d. Random replacement e. MRU

HIRED: You've implemented an LRU cache using a hashmap and doubly linked list. Which of the following best describes its performance characteristics?

a. O(1) lookup, O(n) insert b. O(log n) lookup, O(n) insert b. O(1) lookup, O(1) insert d. O(n) lookup, O(n) insert

HIRED: If a hash table has a hash function that sends all keys to the same bucket, what is the average time complexity fo insert and look up actions?

a. O(1), O(1) b. O(1), O(n^2) c. O(1), O(n) d. O(n), O(n)

HIRED: In an object-oriented language, when might a class method be preferable to an instance method?

a. Only if the class is an abstract class b. When the method has no required arguments c. When the method doesn't access or modify instance state d. When the method updates or modifies global state

HIRED: If you're using an array to implement a queue, in which the oldest item is at index 0 and the newest is at index N, what are the average time-complexities of push and pop operations?

a. Push O(n), Pop O(1) b. Push O(1), Pop O(n) c. Push O(1), Pop O(1) d. Push O(n), Pop O(n)

HIRED: Which of the following statements is not true?

a. Symmetric encryption is typically faster than asymmetric encryption b. Symmetric encryption allows users with a shared secret to securely exchange information across insecure mediums c. In public-key cryptography, data is encrypted using a private key and signed with a public key d. TLS uses both symmetric and asymmetric encryption

given a string of angles brackets such as "<<><>><<<>" return it so that each bracket is closing

coding challenge

Code: Write a function which takes in a generic type, returns the generic type, and prints out a property of length for the type.

interface Lengthwise { length: number; } function printLength<Type extends Lengthwise>(arg: Type): Type { console.log(arg.length) return arg } console.log(printLength({ value: 1, length: 5}))


Conjuntos de estudio relacionados

Area and Perimeter 4th Math BDES

View Set

Chapitre 1 : Les principes fondamentaux de la fiscalité française

View Set

Financial Management Topic 5 (Time Value of Money)

View Set

Mastering A and P cardiovascular system Ch 17

View Set

Macro HW / Sample Exam 1 Quizlet

View Set