triple byte generalist
what is the value of the variable eventPrice after the following code runs?
"$19.99"
x = {'foo': 'bar'}, y={'baz':x}, z = y['baz']['foo'] print z value what is the value of z after the following code runs?
'bar'
The deletion distance between two strings is the minimum sum of ASCII values of characters that you need to delete in the two strings in order to have the same string. The deletion distance between cat and at is 99, because you can just delete the first character of cat and the ASCII value of 'c' is 99. The deletion distance between cat and bat is 98 + 99, because you need to delete the first character of both words. Of course, the deletion distance between two strings can't be greater than the sum of their total ASCII values, because you can always just delete both of the strings entirely. Implement an efficient function to find the deletion distance between two strings. You can refer to the Wikipedia article on the algorithm for edit distance if you want to. The algorithm there is not quite the same as the algorithm required here, but it's similar.
/
x = matrix[0][2] + matrix[2][1]
11
const f = n => n <= 1 ? 1 : n *f(n-1); g=f(4) what is the value of g after the following code block runs?
24
Value of x = f(4)
7
when browsers don't support a new feature, developers turn to polyfills. How do these work?
A polypill implements an API so that developers can build against a consistent interface, even on unsupported browsers A shim that mimics a future API providing fallback functionality to older browsers.
Instagram scroll a vertical feed
At the root, tableview.
Finance app
Core data
UI Components reusable
Custom view controller class
Frame and bounds
Frame size and location of the view coordinate system bound is the same information in its own coordinate system
which of the following http request methods should not alter the state of the server?
GET
which of the following is used to maintain a user's logged-in state as they browse multiple pages on a website?
HTTP cookies
what's wrong with the following React render function? what prints after this.setState({message: "Hello"}) console.log(this.state.message)
It is incorrect to call setState inside a render function setState() does not immediately mutate this.state but creates a pending state transition. Accessing this.state after calling this method can potentially return the existing value. There is no guarantee of synchronous operation of calls to setState and calls may be batched for performance gains. If you want a function to be executed after the state change occurs, pass it in as a callback. this.setState({value: event.target.value}, function () { console.log(this.state.value); });
suppose you receive data from an api as a string containing a JSON object. How should you convert this string into a Javascript object?
JSON.parse(str) The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned. JSON.stringify() The JSON.stringify() method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified.
what's the expected output of the following javascript code?
Larry, Moe, Curly
Sorted list
Makes no sense
Extensión
Methods
event.stopPropagation()
Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
FindIndexOfMin
Right after line 8 set minValue to val
what kind of SQL statement retrieves data from a table?
SELECT
you're writing a music editing app. once a composition is done, the app encodes it (asynchronously) into a specified audio format. When the encoding is complete, you'd like to update the UI in several places in the app. Which of the following approaches makes the most sense?
The important thing here is that we separate the UI update from the actual encoding logic.
Suppose you call React's setState function, then immediately try to console log the state you just set as in the following example. What would you expect to see?
The previous value would be logged with high probability.
when testing your website against your API, you get the following error: Origin http://localhost:8080/ is not allowed by Access-Control-Allow-Origin. Why does this occur?
The same-origin policy restricts how scripts interact with resources on another origin. Make sure your API allows cross-origin requests.
.setTimeout()
The setTimeout() method of the WindowOrWorkerGlobalScope mixin (and successor to window.setTimeout) sets a timer which executes a function or specified piece of code once after the timer expires.
what is the value of g after the following code block runs?
an error occurs
what is the unix entity for time based scheduling?
cron
Suppose we have a page with a button inside a div. We then execute the following Javascript. What will the console read after the button is clicked?
div clicked
Suppose we have a function f which takes 3 arguments. What happens when f is called with only 1 argument?
f will be called with undefined values for the unspecified arguments
how will function_logger and fat_arrow_logger behave differently?
fat arrows are just semantic sugar for function(). There is no difference between the two.
in what order does f receive its arguments? ?Hoisting What order does function execute? function foo() { function(bar) { setTimeout( () => console.log('Curly'), 1000 )) } console.log('Larry'); return bar; }
foo bar baz
you are working in a git repository, and accidentally deleted a commit. Which command will help get it back
git reflog
which of the following programming languages does not support operator overloading?
go
Center Vertically or Horizontally?
https://css-tricks.com/centering-css-complete-guide/
Why does the following tag appear in HTML pages?
it is used to prevent request forgery from external sites
Why is caching used to increase read performance?
it makes the second and subsequent reads faster
Which of the following styles will horizontally center a fixed-size element inside its parent?
margin auto
center child element horizontally
margin:0 auto; will make sure there are equal amounts of space on either side of the element. margin-left:50%; is relative to the parent. For example, if the container is 1000px wide, you will have a left margin of 500px on the child element. However, that will not center the element, it will place it's left side in the middle — unless you hack it with a fixed value on the child element as in your example. Usually, when you are dealing with a wrapper as in your case, margin:0 auto; is the simplest and most flexible solution. In other cases, you might find it better to use a percentage or fixed value (for example, when floating stuff)
def find_max(nums):
max_num = num
Cumulative sum
output.push(list[i] + output[i - 1]
suppose we have a page with the following style and a handful of empty divs with class pink. What is rendered on the page?
pink squares are stacked horizontally
def first_index_of_element_in_array(element, array) Return index
return I if array_element == element
makeAdder(x) fill in the missing line of code
return function(y){ return x + y;}
fill in the missing line of code: strToFloat(str)
return parseFloat(str) The parseFloat() function parses an argument and returns a floating point number function circumference(r) { return parseFloat(r) * 2.0 * Math.PI; } console.log(circumference(4.567)); // expected output: 28.695307297889173
func(unique)
seen[value] = true
which of the following strategies should we use to efficiently serve static assets to users around the globe?
serve assets from our NGINX instance so that requests are authoritative but don't hit our app servers. NGINX is a very powerful web server. You can do a ton of things with it, such as setting up reverse proxies or load balancing. It can also be used to host your static website. Move your website's static files to the nginx server
why are more developers using new style sheet languages like LESS and SASS instead of CSS?
they compile to CSS, but provide convenient syntax for nesting, variables, and other features. -Nested Syntax -Ability to define variables -Ability to define mixins -Mathematical functions -Operational functions(lighten, darken) -Joining of multiple files. "&" sumbol joins next statement to it's parent. &hover { color: #123455
Image view do catch
ui freezes while image download
which of the following is the best use case for a regular expression?
validate IP address
suppose you're designing a distributed worker library, and would like it to be able to queue jobs using a number of different message queueing services. What's a good way to handle making our code work with each of these services?
we could design a base interface that defines how our library will interact with the queue service. we can create several implementations of this interface . A method that runs when our library loads can look at config details, and instantiate the correct object.
how do webpack and babel differ?
webpack is a module bundler, whereas babel is a javascript compiler
is it generally safe to make a POST request that contains a user's password in plaintext?
yes, if the connection is over https, the information is secure in transit
What is the layer property on UIView object
?The bounds property defines the internal dimensions of the view as it sees them, and its use is almost exclusive to custom drawing code. The center property provides a convenient way to reposition a view without changing its frame or bounds properties directly.