Sunday, November 7, 2021

Multiple Choice Questions - Angular 4 Bindings

 1. Data bindings are applied as . . . . . . . . or as special sequences of characters in strings.

A) expressions
B) attributes on HTML elements
C) elements itself
D) none of above

2. Binding types such as Interpolation, Property, Attribute, Class and Style support . . . . . . data flow from the data source (exposed from the component) to a view or template.

A) one-way
B) two-way
C) three-way
D) both-ways

3. Angular provides a special version of the standard property binding, known as the . . . . . . . . ., that is used to include expression results in the text content of host elements.

A) string extrapolation binding
B) evaluation binding
C) crypto binding
D) string interpolation binding

4. A data binding has these four parts:

A) host element, curly brackets, target, expression
B) host element, square brackets, target, evaluation
C) host element, square brackets, target, expression
D) host element, parentheses, target, expression

5. Property binding works on component properties too.

A) True
B) False

6. Two-way binding allows for data to be easily displayed and updated simultaneously. This makes it easy to reflect any changes the user makes to the DOM. Angular does this by using . . . . . . to watch for changes and then update the value.

A) ng-init
B) ngModel
C) ng-bind
D) ngControl

7. The . . . . . . . tell Angular that this is a one-way data-binding that has an expression that should be evaluated.

A) parentheses ()
B) curly brackets
C) angle brackets ⟨ ⟩
D) square brackets (the [ and ] characters)

8. Attribute binding is similar to property binding but is tied to the . . . . . . . . rather than the DOM property.

A) Page attribute
B) DOM attribute
C) Root attribute
D) HTML attribute

9. The most commonly encountered attribute without a corresponding property is . . . . . ., which is used to set the number of columns that a td element will occupy in a table.

A) href
B) src
C) colspan
D) rowspan

10.

A) This binding evaluates the expression and uses the result to replace any existing class memberships.
B) This binding evaluates the expression and uses the result to set the element’s membership of class.
C) This binding sets class membership of multiple classes using the data in a map object.

Answers
1) b, 2) a, 3) d, 4) c, 5) a, 6) b, 7) d, 8) d, 9) c, 10) a

Multiple Choice Questions - Angular 4 Animations

Angular's animation system lets you build animations that run with the same kind of native performance found in pure CSS animations. You can also tightly integrate your animation logic with the rest of your application code, for ease of control.

Angular animations are built on top of the standard Web Animations API and run natively on browsers that support it. [Via]

Answer the below quiz questions on Angular Animations and check your knowledge on the topic.

1. To make your applications ready for animations, you must include the AngularJS Animate library and then you must refer to the . . . . . module in your application.

A) ng-repeat
B) ngAnimation
C) ngAnimate
D) None of above

2. Using the . . . . . . animation function, the parent animation can allow the child animation to run at the exact correct time.

A) animateChild
B) childAnimate
C) animateInner
D) innerChild

3. Options as well as input params can also be passed into an animation binding value when the animation kicks off.

A) True
B) False

4. Animations are fired using animation property bindings which are prefixed with an . . . . symbol.

A) &
B) #
C) $
D) @

5. . . . . . . allows for child elements to be collected and animated against a bunch of animation steps. We can now grab inner elements and make a really cool multi-element animation sequence.

A) child()
B) query()
C) stagger()
D) animate()

6. [Choose all which are correct]
The major addition to the animation DSL in Angular 4.2 is the ability to configure/override options for each of the step-based animation methods. These methods are:

A) sequence([...], { /* options */ })
B) groups([...], { /* options */ })
C) trigger([...], { /* options */ })
D) transition([...], { /* options */ })

7. . . . . . . is an animation-specific function that is designed to be used inside of Angular's animation DSL language. It is used to kick off a reusable animation that is created using animation().

A) useAnimation
B) reuseAnimation
C) in-useAnimation
D) All of above

8. With ngAnimate module you can add CSS but not JavaScript-based animations to your projects.

A) True
B) False

9. It's always possible to make use of animation input parameters by setting even more data via the . . . . . property.

A) options.param
B) option.params
C) option.param
D) options.params

10. . . . . . reverts all the used styles in the animation back to their end state value.

A) styles("*")
B) style("+")
C) style("*")
D) style("#")

Answers
1) c, 2) a, 3) a, 4) d, 5) b, 6) a,c,d, 7) a, 8) b, 9) d, 10) c

PHP Strings & Reg Exp Multiple Choice Questions

 1)

Which of the following will not combine strings $s1 and $s2 into a single string?

A) $s1 + $s2
B) "{$s1}{$s2}"
C) $s1.$s2
D) implode(' ', array($s1,$s2))
E) All of the above combine the strings

2)
Given a variable $email containing the string user@example.com, which of the following statements would extract the string example.com?

A) substr($email, strpos($email, "@"));
B) strstr($email, "@");
C) strchr($email, "@");
D) substr($email, strpos($email, "@")+1);
E) strrpos($email, "@");

3)
Given a comma-separated list of values in a string, which function from the given list can create an array of each individual value with a single call?

A) strstr()
B) Cannot be done with a single function
C) extract()
D) explode()
E) strtok()

4)
What is the best all-purpose way of comparing two strings?

A) Using the strpos function
B) Using the == operator
C) Using strcasecmp()
D) Using strcmp()

5)
Which of the following PCRE regular expressions best matches the string php|architect?

A) .*
B) ...|.........
C) \d{3}\|\d{8}
D) [az]{3}\|[az]{9}
E) [a-z][a-z][a-z]\|\w{9}

6)
Which of the following functions can be used to determine the integrity of a string?

A) md5()
B) sha1()
C) str_rot13()
D) crypt()
E) crc32()

7)
What happens if you add a string to an integer using the + operator?

A) The interpreter outputs a type mismatch error
B) The string is converted to a number and added to the integer
C) The string is discarded and the integer is preserved
D) The integer and string are concatenated together in a new string

E) The integer is discarded and the string is preserved

8)
The ___________ function can be used to compare two strings using a case-insensitive binary algorithm

A) strcmp()
B) stricmp()
C) strcasecmp()
D) stristr()
E) None of the above

9)
Which of the following functions can be used to convert the binary data stored in a string into its hexadecimal representation?

A) encode_hex()
B) pack()
C) hex2bin()
D) bin2hex()
E) printf()

10)
^[A-Za-z].* matches

A) play it again
B) I
C) 123
D) ?

11)
^[0-9]{5}(\-[0-9]{4})?$ matches

A) 90001 and 90002-4323
B) 9001 and 12-4321

Answers

1) A, 2) D, 3) D, 4) D, 5) E, 6) A,B,E, 7) B, 8) C, 9) B,D, 10) A, B, 11) A

Multiple Choice Questions - AngularJS

 1. AngularJS is based on the . . . . . . pattern.


A) VMC
B) MVC
C) MCV
D) CVM

2. AngularJS applications are a mix of . . . . . .

A) HTML and PHP
B) HTML and CrossScript
C) HTML and AngularScript
D) HTML and JavaScript

3. We need to tell AngularJS what part of our HTML page contains the AngularJS app. You do so by adding the . . . . attribute to the root HTML element of the AngularJS app.

A) ng-app
B) ag-app
C) js-app
D) aj-app

4. There is a controller which takes single parameter. We call it . . . . . parameter.

A) $param
B) $control
C) $scope
D) $scont

5. The . . . . . . directive is one of the most fundamental directives in AngujarJS. The . . . . . directive inserts the result of an expression into the HTML template.

A) Debug
B) Interpolation
C) Matching
D) Controller

6. First the HTML document is loaded into the browser, and evaluated by the browser. At this time the AngularJS . . . . . . .

A) JavaScript file is loaded,
B) the angular global object is created,
C) your JavaScript which registers controller functions is executed,
D) all of above

7. You cannot use AngularJS directives to tell AnguluarJS how to mix the data into the HTML template.

A) True
B) False

8. If the data obtained from the model contains HTML elements, these are escaped before being inserted into the HTML template. The escaping means that the HTML is displayed as text, and not as HTML. This is done to prevent . . . .

A) SQL injection attacks
B) JS injection attacks
C) HTML injection attacks
D) Python injection attacks

9. AngularJS can show or hide HTML depending on the state of data in the model. You do so using a set of AngularJS directives such as . . . . . . which are created specifically for that purpose.

A) ng-shown, ng-hidden
B) ng-show, ng-hide
C) nt-show, nt-hide
D) ng-shows, ng-hides

10. The . . . . . directive is used if you want to add or remove HTML elements from the DOM based on data in the model.

A) ng-switch
B) ng-model
C) ng-Disabled
D) ng-Cloak

Answers
1) b, 2) d, 3) a, 4) c, 5) b, 6) d, 7) b, 8) c, 9) b, 10) a

Multiple Choice Questions - Angular2 Directives

 1. In Angular 2 . . . . . . . . directive allows us to iterate through a collection.


A) NgRepeat
B) NgWhile
C) NgIf
D) NgFor

2. Both the following examples involving the directives are identical: 

A) True
B) False

3. The shadow DOM allows to encapsulate the styles of web components without allowing them to leak outside the component’s scope. If we want Angular’s renderer to use the shadow DOM, we can use . . . . . . .

A) ViewEncapsulation.None
B) ViewEncapsulation.Native
C) ViewEncapsulation.Emulated
D) ViewEncapsulation.Natural

4. Which of the below syntax will clone and inject pieces of templated HTML snippets in the markup, removing it from the DOM when the condition evaluates to false.

A) *ngIf="conditional"
B) [hidden]="conditional"
C) ngIf*="conditional"
D) None of above

5. The three types of directives in Angular 2 are . . . . . . . . . . .

A) advanced directives
B) attribute directives
C) structural directives
D) components

6. We can use the NgFor and NgIf directives using the . . . . . . . symbol to indicate we're dealing with a directive that creates a template.

A) hash (#)
B) escape (/)
C) asterisk (*)
D) percent (%)

7. A special mention is required about the children element marked with the . . . . . . . . . . . directive attribute. This attribute qualifies the template that will be displayed when no other value defined by its ngSwitchWhen siblings matches the parent conditional expression.

A) ngDefault
B) ngTemplateDefault
C) ngDefaultSwitch
D) ngSwitchDefault

8. Since Angular 2 defines a set of built-in directives, the . . . . . . . . method passes them in a similar way in order to make them available in the entire application in order to prevent us from code duplications.

A) startup
B) bootstrap
C) constructor
D) initialization

9. Structural directives change the DOM layout by adding and removing DOM elements and the . . . . . . . . directives change the appearance or behavior of an element.

A) attribute
B) advanced
C) component
D) same

10. . . . . . . . . . refers to values that parameterize the directive’s behaviour and/or view. On the other hand, . . . . . . . . refers to events that the directive fires when something special happens.

A) Inputs, output
B) Output, inputs

Answers
1) d, 2) a, 3) b, 4) a, 5) b,c,d, 6) c, 7) d, 8) b, 9) a, 10) a

Get max value for identity column without a table scan

  You can use   IDENT_CURRENT   to look up the last identity value to be inserted, e.g. IDENT_CURRENT( 'MyTable' ) However, be caut...