-
Notifications
You must be signed in to change notification settings - Fork 61
/
file.js
2408 lines (2355 loc) · 97.2 KB
/
file.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// Titles in the Decks
//
// Javascript: Core Concepts
// Javascript: Functions
// Javascript: Common built-in methods
// Javascript: Common event handlers
// Javascript: Design patterns
// CSS
// CSS: Pseudo-classes
// CSS: Animations
// CSS3 - Flexbox
// HTML
// React
// Angular
// Javascript: 3
// Vue
// DOM Fundamentals
// ES6
// JavaScript: Intermediate
// SASS: Basics
// Webpack Basic Concepts
// jQuery: Basics
// General Front End Questions
// Git
//
export function deckData() {
return [
{
title: "Javascript: Core Concepts",
image: "../style/images/js.png",
cards: [
{
q: "What is event bubbling?",
a:
'An event received by an element doesn\'t stop with that one element. That event moves to other elements like the parent, and other ancestors of the element. This is called "event bubbling".'
},
{
q: "What is event delegation?",
a:
"Event delegation allows you to avoid adding event listeners to specific nodes; instead, the event listener is added to one parent. That event listener analyzes bubbled events to find a match on child elements."
},
{
q: "What is the difference between using == and === ?",
a:
"Triple equals uses type coercion and compares both value and type. It prevents unintentional truthy cases like false == 0."
},
{
q: "What do we call data types copied by VALUE?",
a: "Primitives"
},
{
q: "What do we call data types copied by REFERENCE?",
a: "Objects"
},
{
q: "What are the six primitives?",
a: "Boolean, null, undefined, string, number and symbol"
},
{
q: "What are the three object data types?",
a: "Array, Function, and Object"
},
{
q: "How can you access properties of an Object in JavaScript?",
a: 'x.name or x["name"]'
},
{
q: "Difference between call() and apply()?",
a:
"CALL() takes a regular listing of parameters and APPLY() requires the parameters to be in an array."
},
{
q: "What is the purpose of -this- operator in JavaScript?",
a:
"This, always refers to properties or methods accessible to a developer on an object."
},
{
q: "What are the valid scopes of a variable in JavaScript?",
a:
"The region of your program in which it is defined. There are three: \n -Global Variables − A global variable has global scope which means it is visible everywhere in your JavaScript code.\n-Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.\nBlock Scoped variables- variables defined using const/let keywords are scoped to the block in which they are defined."
},
{
q:
"Which type of variable among global and local, takes precedence over other if names are same?",
a:
"A local variable takes precedence over a global variable with the same name."
},
{
q: "What is callback?",
a:
"A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered."
},
{
q: "Explain Lexical Scoping",
a:
'Lexical Scoping describes how a parser resolves variable names when functions are nested. \nThe word "lexical" refers to the fact that lexical scoping uses the location where a variable is declared within the source code to determine where that variable is available. \nE.G. Nested functions have access to variables declared in their outer scope.'
},
{
q: "What is closure?",
a:
"Closures are created whenever a variable that is defined outside the current scope is accessed from within some inner scope."
},
{
q: "Give an example of closure?",
a:
"Following example shows how the variable counter is visible within the create, increment, and print functions, but not outside of them −\nfunction create() {\nvar counter = 0;\nreturn {\nincrement: function() {\ncounter++;\n},\n\nprint: function() {\nconsole.log(counter);\n}\n}\n}\nvar c = create();\nc.increment();\nc.print(); // ==> 1\n"
},
{
q: "Adding a number and a string results in?",
a:
"Coercion: converting a value from one type to another. This happens because JS is dynamically typed."
},
{
q:
'What is the difference between "undefined" and "null" in JavaScript?',
a:
'"undefined" means variable is declared but not yet assigned a value and null is a value that can be assigned of type "object".'
},
{
q: "What boolean operators does JavaScript support?",
a: "&&, || and !"
},
{
q: "What does isNaN function do?",
a: "Return true if the argument is not a number."
},
{
q:
'What is the difference between "undefined" and "not defined" in a JavaScript error?',
a:
'"Undefined" means a variable is declared but not assingned any values but "Not defined" means the variable is not declared yet.'
},
{
q: "What is the difference between == and === in JavaScript?",
a:
"The == operator checks only equality of the values while === checks equality of values with its datatype i.e. values should be of same type."
},
{
q:
"What are different programming paradigm important for JavaScript developers?",
a:
"Procedural Programming with Object Oriented Programming and Fuctional Programming."
},
{
q: "How can you get type of arguments passed to a function?",
a:
'Using "typeof" operator. Ex- function abc(x){console.log(typeof x, arguments.length);}//Here when function "abc" is called it returns the type and length of passed value.'
},
{
q:
"What is the disadvantage of creating true private methods in JavaScript?",
a:
"They are very memory inefficient as a new copy of method is created every instance."
},
{
q: "How to use external JavaScript file?",
a:
'<script type="text/javascript" src="myfile.js"></script> "Here It is assumed that myfile.js is the external js file". '
},
{
q:
'What is the difference between "undefined" and "null" in JavaScript?',
a:
'"undefined" means variable is declared but not yet assigned a value and null is a value that can be assigned of type "object".'
},
{
q: "Explain HOISTING",
a:
"Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution."
},
{
q: "What's the difference between .call and .apply?",
a:
"The difference is that apply lets you invoke the function with arguments as an array; call requires the parameters be listed explicitly"
},
{
q: "What is function composition?",
a:
"Function composition is the process of combining two or more functions to produce a new function. Composing functions together is like snapping together a series of pipes for our data to flow through."
},
{
q: "What is DOM in javascript?",
a:
"A hierarchial structure to access or modify a web page is called Document Object Model or DOM."
},
{
q: "How do you reference a form field in javascript?",
a:
'To refer a form field from javascript, you can use : document.getElementById("myform").txtName or document.getElementById("myform") methods'
}
]
},
// JavaScript: Functions
{
title: "JavaScript: Functions",
image: "../style/images/js.png",
cards: [
{
q:
"Major difference between function expression vs function declaration?",
a:
"Function expression:\n- named or unnamed ex. var myFunc = function( ) { }\n Function declaration: \n- named ex. function myFunc( ) { } "
},
{
q: "Functions are treated as what type in JavaScript?",
a: "Object"
},
{
q:
"What do we call a function that gets executed at the end of an operation, once all of the other operations have been completed",
a: "Callback function"
},
{
q:
"When passing named functions as callback, why might you not normally include parentheses - ex. .addEventListener('click', myFunction)",
a: "myFunction() would return result of myFunction"
},
{
q:
"What is the major difference between functions vs variables in regards to hoisting?",
a: "Some functions are usable before they are declared"
},
{
q:
"What is a function defined inside an expression, ex. var x = function(){ }?",
a: "Function expression"
},
{
q: "Are function expressions hoisted?",
a: "Nope"
},
{
q: "What do you call a function created between { }?",
a: "Block-level function - (pro tip: don't use unless in strict mode)"
},
{
q:
"1) Identifying what functions caused errors, 2) more understandable and accessible, 3) easier to reuse, all are major advantages of what type of functions?",
a: "Named functions"
},
{
q: "___ functions are only created at runtime",
a: "Anonymous"
},
{
q: "What does 'IIFE' stand for",
a: "Immediately Invokable Function Expression"
},
{
q:
"Functions that take one or more functions as an input, or functions that output another function, are called?",
a: "Higher order functions "
},
{
q: "What type of function is: (parameters) => { statements } ",
a: "Arrow function"
},
{
q: "Are parentheses option in arrow functions?",
a: "Yes - if you have only one variable"
},
{
q: "Are brackets option in arrow functions?",
a: "Yes - if you want to return the expression"
},
{
q: "Can arrow functions be used as constructors?",
a: "Nope"
},
{
q: "Do arrow functions bind .this?",
a: "Nope - they have lexical binding (this stays in previous scope)"
},
{
q:
"What type of function would this be? \n(function() {\nconsole.log('lumos');\n})();",
a: "IIFE (Immediately Invokable Function Expression)"
},
{
q: "Why would you use an IIFE?",
a:
"It enables you to attach private data to a function, creates fresh environments and avoids polluting the global namespace."
},
{
q:
"A _____ function is a one that happens to be called with the 'new' operator.",
a: "Constructor - ex. var g = new Graph()"
}
]
},
// JavaScript: Common built-in methods
{
title: "JavaScript: Common built-in methods",
image: "../style/images/js.png",
cards: [
{
q: "Returns code of character?",
a: "charCodeAt()"
},
{
q:
"Returns the index within the calling String object of the last occurrence of the specified value starting?",
a: "lastIndexOf()"
},
{
q:
"Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order?",
a: "localeCompare()"
},
{
q:
"Returns a new string with some or all matches of a pattern replaced by a replacement?",
a: "replace()"
},
{
q:
"Executes a search for a match between a regular expression and this String object?",
a: "search()"
},
{
q: "Extracts a section of a string and returns it as a new string?",
a: "slice()"
},
{
q:
"Splits a String object into an array of strings by separating the string into substrings, using a specified separator string to determine where to make each split?",
a: "split()"
},
{
q:
"Returns a subset of a string between one index and another, or through the end of the string?",
a: "substring()"
},
{
q:
"Returns the calling string value converted to lower case, according to any locale-specific case mappings?",
a: "toLocaleLowerCase()"
},
{
q:
"Returns the calling string value converted to upper case, according to any locale-specific case mappings?",
a: "toLocaleUpperCase()"
},
{
q: "Returns the character at the specified index?",
a: "charAt()"
},
{
q: "Returns the unicode integer of a character/index",
a: "charCodeAt(index)"
},
{
q: "Combines the text of two strings and returns a new string?",
a: "concat()"
},
{
q: "Calls a function for each element in the array?",
a: "forEach()"
},
{
q:
"Returns the index within the calling String object of the first occurrence of the specified value?",
a: "indexOf()"
},
{
q: "Concatenate elements of an array into a string?",
a: "join()"
},
{
q: "Returns the length of the string?",
a: "length()"
},
{
q: "Removes the last element from an array and returns that element?",
a: "pop()"
},
{
q:
"Adds one or more elements to the end of an array and returns the new length of the array?",
a: "push()"
},
{
q: "Reverses the order of the elements of an array?",
a: "reverse()"
},
{
q: "Returns a copy of a selection of an array?",
a: "slice()"
},
{
q: "Sorts the elements of an array?",
a: "sort()"
},
{
q:
"Changes the contents of an array by removing existingelements or adding elements?",
a: "splice()"
},
{
q:
"Returns the characters in a string beginning at the specified location?",
a: "substr()"
},
{
q: "Returns the calling string value converted to lower case?",
a: "toLowerCase()"
},
{
q: "Returns the calling string value converted to upper case?",
a: "toUpperCase()"
},
{
q: "Returns the string representation of the numbers value?",
a: "toString()"
},
{
q: "Writing/Displaying data into an alert box?",
a: "window.alert()"
},
{
q: "Writing/Displaying data into the browser console?",
a: "console.log()"
},
{
q:
"Display an alert message along with asking the user to enter a value?",
a: "window.prompt()"
},
{
q:
"Show a confirmation message and ask the user to confirm or cancel?",
a: "window.confirm()"
},
{
q: "Get an integer number from a string?",
a: "parseInt()"
},
{
q: "Get a float number from a string",
a: "parseFloat()"
},
{
q: "Convert a string to base 64?",
a: "window.btoa()"
},
{
q: "Convert a base 64 to string?",
a: "window.atob()"
},
{
q:
"Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order?",
a: "localeCompare()"
},
{
q: "Used to match a regular expression against a string?",
a: "match()"
},
{
q:
"Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring?",
a: "replace()"
},
{
q:
"Returns true if every element in this array satisfies the provided testing function?",
a: "every()"
},
{
q:
"Returns true if at least one element in this array satisfies the provided testing function?",
a: "some()"
},
{
q:
"Creates a new array with all of the elements of this array for which the provided function returns true?",
a: "filter()"
},
{
q:
"Removes the first element from an array and returns that element?",
a: "shift()"
},
{
q:
"Adds one or more elements to the front of an array and returns the new length of the array?",
a: "unshift()"
},
{
q: "Returns current date and time?",
a: "Date()"
},
{
q:
"Returns the day of the month for the specified date according to local time?",
a: "getDate()"
},
{
q:
"Returns the day of the week for the specified date according to local time?",
a: "getDay()"
},
{
q: "Returns the month in the specified date according to local time?",
a: "getMonth()"
},
{
q: "Returns the year of the specified date according to local time?",
a: "getFullYear()"
},
{
q: "Returns a pseudo-random number between 0 and 1?",
a: "random()"
},
{
q: "Returns the largest of zero or more numbers?",
a: "max()"
},
{
q: "Returns the smallest of zero or more numbers?",
a: "min()"
},
{
q:
"Defines how many total digits (including digits to the left and right of the decimal) to display of a number?",
a: "toPrecision()"
},
{
q: "Evaluates an expression?",
a: "eval()"
},
{
q: "Checks if the content of a variable is valid?",
a: "isNaN()"
},
{
q:
"Which string method removed whitespace from either end of a string?",
a:
"The trim() method returns the string stripped of whitespace from both ends. trim() does not affect the value of the string itself."
}
]
},
//JavaScript: Common event handlers
{
title: "JavaScript: Common event handlers",
image: "../style/images/js.png",
cards: [
{
q: "What handler fires when loading stopped?",
a: "onAbort"
},
{
q: "Handles losing focus?",
a: "onBlur"
},
{
q: "What handler fires when content is modified?",
a: "onChange"
},
{
q: "Handles click?",
a: "onClick"
},
{
q: "What handler detects if clicked twice?",
a: "onDblClick"
},
{
q: "What handler fires when element is moved?",
a: "onDragDrop"
},
{
q: "What handler fires when document is not loaded?",
a: "onError"
},
{
q: "What handler fires on focus enter?",
a: "onFocus"
},
{
q: "What handler fires on key depress?",
a: "onKeyDown"
},
{
q: "What handler fires on key press?",
a: "onKeyPress"
},
{
q: "What handler fires on key release?",
a: "onKeyUp"
},
{
q: "What handler fires just after document loading?",
a: "onLoad"
},
{
q: "What handler fires on mouse button depress?",
a: "onMouseDown"
},
{
q: "What handler fires on mouse move?",
a: "onMouseMove"
},
{
q: "What handler fires on mouse exit?",
a: "onMouseOut"
},
{
q: "What handler fires when mouse is on the element?",
a: "onMouseOver"
},
{
q: "What handler fires on mouse button release?",
a: "onMouseUp"
},
{
q: "What handler fires when reset form button is clicked?",
a: "onReset"
},
{
q: "What handler fires when page size changes?",
a: "onResize"
},
{
q: "What handler fires when element is selected?",
a: "onSelect"
},
{
q: "What handler fires when form is submitted?",
a: "onSubmit"
},
{
q: "What handler fires when page is exited?",
a: "onUnload"
}
]
},
// JavaScript: Design patterns
{
title: "JavaScript: Design patterns",
image: "../style/images/js.png",
cards: [
{
q: "Name a few design patterns for JS",
a:
"Module, Singleton, \nPrototype, Observer, \nConstructor, Revealing Module, \nMediator, Command, \nDecorator, Flyweight, \nFacade, Factory, Mixin"
},
{
q: "What is a Design Pattern?",
a:
"A design pattern is a reusable software solution to a specific type of problem that occurs frequently when developing software"
},
{
q: "Describe The Decorator Pattern",
a:
"The decorator is defined as a design pattern that allows behaviour to be added to an existing object dynamically"
},
{
q: "What does MVC stands for?",
a: "Model View Controller"
},
{
q:
"Which pattern is it? Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.",
a: "Observer pattern"
},
{
q:
"What does “favor object composition over class inheritance” mean?",
a:
"That objects should only include the required functionality from different classes instead of inheriting the whole base class, which will have many unused methods"
},
{
q: "Define Composite pattern",
a:
"The composite pattern says that a group of objects can be treated in the same manner as an individual object of the group"
},
{
q:
"Which design pattern restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system",
a: "Sigleton"
}
]
},
// CSS
{
title: "CSS",
image: "../style/images/css3.svg",
cards: [
{
q: "What is CSS?",
a:
"Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable."
},
{
q: "What are the components of a CSS Style?",
a:
"Selector − an HTML tag like <h1> or <table> \nProperty − attribute of HTML tag, ex. color, border \nValue − assigned to properties, ex. color property can have red or #F1F1F1"
},
{
q: "What is type selector?",
a:
"Matches the name of an element type. To give a color to all level 1 headings −\nh1 {\ncolor:\n#36CFFF;\n}"
},
{
q: "What is universal selector?",
a: "Matches the name of any element type −\n* { \ncolor: #000000; \n}"
},
{
q: "What is Descendant Selector?",
a:
"Apply a style rule to a particular element only when it lies inside a particular element. As given in the following example, style rule will apply to <em> element only when it lies inside <ul> tag. \nul em {\ncolor: #000000; \n}"
},
{
q: 'What is "Z-index"',
a:
"Z-index specifies the z-order of a positioned element and its descendants. If one element had a z-index of 0 and another had a z-index of 1, the element with a z-index of 1 would be above/overlapping the other element."
},
{
q: "What is the Box Model",
a:
"The Box Model is the term used for the CSS standard model used by a browser's rendering engine when laying out a document: each element is represented as a rectangular box."
},
{
q: "What are preprocessor and postprocessors?",
a:
"Preprocessors and postprocessors both modify and extend the behavior of CSS. Preprocessors are written in a different language (SASS, SCSS, LESS) that is then compiled to CSS. Post Processors (PostCSS) compile CSS and add additional properties to it - such as vendor prefixes."
},
{
q: "What are vendor (or browser) prefixes?",
a:
"These are a way for browsers to add support for new features before they are supported. They are particularly important when considering cross browser compatability. Some more common examples are: -webkit, -moz, and -ms"
},
{
q: "What is the purpose of a pseudo-class",
a:
"Pseudo-classes specify a special state for selected elements\nExample -\n div:hover { \n/** set styles for when mouse is over div */ \n}"
},
{
q: "What is the difference between a class and an ID selector?",
a:
"An id selector is used to style one specific element, but a class selector can be used to style multiple elements."
},
{
q: "What are pseudo elements?",
a:
"Pseudo-elements are a keyword added to selectors to style specific parts of the selected elements\nExample -\n p::first-line { \n /** Style the first line of the element red */ color: #F00; \n}"
},
{
q: "How can elements be fixed on the screen?",
a: "Using the property position: fixed;"
},
{
q:
"What is the difference between an element whose position is fixed vs absolute?",
a:
"A fixed position element has the position relative to the viewport. A absolutely positioned element has the position set relative to it's nearest positioned ancestor."
},
{
q:
"How are text or inline elements centered inside their parent element?",
a: "Using the property text-align: center"
},
{
q: "What is the difference between margin and padding?",
a:
"Padding is the space between border and element contents, margin is the space between border and neighboring elements."
},
{
q: "How can CSS styles be applied inline in HTML?",
a: "Using the style attribute on element tags."
},
{
q: "How are background images set for an element?",
a: "Using background-image: url('path/to/image.png')"
},
{
q: "How are CSS selectors grouped together",
a: "Using the comma (,) separator."
},
{
q: "How can a font family be set throughout the page?",
a:
"By applying the font-family property on the body tag -\nbody { \nfont-family: 'Comic Sans'; \n}"
},
{
q: "How can the style of a list be changed?",
a: "Using the property list-style-type."
},
{
q: "How are CSS stylesheets added to HTML pages?",
a:
'Using the <link rel="stylesheet" href="path/to/style.css" type="text/css" />'
},
{
q: "What tag is used to internally add CSS styles to a HTML page?",
a: "The <style> tag"
},
{
q: "Which property used to change the color of text?",
a: "Using the property color"
},
{
q: "How is a background image set to be fixed?",
a: "Using the property background-attachment: fixed"
},
{
q: "What is the difference between width: 100% and width: 100vw?",
a:
"The former sets the element width as that of the parent content area, whereas the latter sets the elements width to the width of the entire viewport"
},
{
q:
"When setting a z-index to an element what other css atribute must also be set?",
a: "An element must have a display setting to utilize z-indexing"
},
{
q:
"When using flex-box to create a responsive layout what atribute will allow a containers elemets to not break outside a set media query",
a:
"Using flew-wrap will allow a given set of elements to break and re order when there parent container becomes too small"
},
{
q:
"When laying out a number of variable sized containers, each with text inside, how can flex-box be used to align this text",
a:
"Using align-items with the baseline attribute will position the elemnts inside there parent containers."
},
{
q: "Can flex-box commands be chained or combined",
a:
"Yes flex-grow | flex-shrink | flex-basis can be written as flex: 5 5 10%;"
},
{
q: "Differentiate Class selector from ID selector?",
a:
"While an overall block is given to class selector, ID selector prefers only a single element differing from other elements. In other words, ID are uniques while classes are not. Its possible that an element has both class and ID."
},
{
q: "What is Pseudo-elements?",
a:
"Pseudo-elements are used to add special effects to some selectors. CSS in used to apply styles in HTML mark-up. In some cases when extra mark-up or styling is not possible for the document, then there is a feature available in CSS known as pseudo-elements. It will allow extra mark-up to the document without disturbing the actual document."
},
{
q:
"What happens if 100% width is used along with floats all across the page?",
a:
"While making the float declaration, 1 pixel is added every time it is used in the form of the border, and even more float is allowed thereafter."
},
{
q: "Can default property value be restored through CSS? If yes, how?",
a:
"In CSS, you cannot revert back to old values due to lack of default values. The property can be re- declared to get the default property."
},
{
q: "What is contextual selector?",
a:
"Selector used to select special occurrences of an element is called contextual selector. A space separates the individual selectors. Only the last element of the pattern is addressed in this kind of selector. For e.g.: TD P TEXT {color: blue}"
},
{
q: "Define Image sprites with context to CSS ?",
a:
"When a set of images is collaborated into one image, it is known as ‘Image Sprites’. As the loading every image on a webpage consumes time, using image sprites lessens the time taken and gives information quickly."
},
{
q: "How does Z index function?",
a:
"Overlapping may occur while using CSS for positioning HTML elements. Z index helps in specifying the overlapping element. It is a number which can be positive or negative, the default value being zero."
},
{
q: "Define float property of CSS?",
a:
"By float property, the image can be moved to the right or the left along with the text to be wrapped around it. Elements before this property is applied do not change their properties."
},
{
q: "What is graceful degradation?",
a:
"In case the component fails, it will continue to work properly in the presence of a graceful degradation. The latest browser application is used when a webpage is designed. As it is not available to everyone, there is a basic functionality, which enables its use to a wider audience. In case the image is unavailable for viewing, text is shown with the alt tag."
},
{
q: "What is progressive enhancement?",
a:
"It’s an alternative to graceful degradation, which concentrates on the matter of the web. The functionality is same, but it provides an extra edge to users having the latest bandwidth. It has been into prominent use recently with mobile internet connections expanding their base."
},
{
q: "What is Alternate Style Sheet?",
a:
"Alternate Style Sheets allows the user to select the style in which the page is displayed using the view>page style menu. Through Alternate Style Sheet, user can see a multiple version of the page on their needs and preferences."
},
{
q: "Differentiate Style Sheet concept from HTML?",
a:
"While HTML provides easy structure method, it lacks styling, unlike Style sheets. Moreover, style sheets have better browser capabilities and formatting options."
},
{
q: "Comment on the Case-sensitivity of CSS ?",
a:
"Although, there are no case-sensitivity of CSS, nevertheless font families, URL’s of images, etc is. Only when XML declarations along with XHTML DOCTYPE are being used on the page, CSS is case -sensitive."
},
{
q: "Define Declaration block?",
a:
"A catalog of directions within braces consisting of property, colon and value is called declaration block. e.g.: [property 1: value 3]"
},
{
q: "Why is it easy to insert a file by importing it?",
a:
"Importing enables combining external sheets to be inserted in many sheets. Different files and sheets can be used to have different functions. Syntax: @import notation, used with <Style> tag."
},
{
q: "Differentiate logical tags from physical tags?",
a:
"While physical tags are also referred to as presentational mark-up, logical tags are useless for appearances, also Physical tags are newer versions while logical tags are old and concentrate on content."
},
{
q: "Enlist the media types CSS allows? ",
a:
"The design and customization of documents are rendered by media. By applying media control over the external style sheets, they can be retrieved and used by loading it from the network."
},
{
q:
"Explain the difference between visibility:hidden and display:none",
a:
"By visibility:Hidden;the element is not visible but takes up the original space, whereas by display:None element is hidden and takes up no space as if it was never there."
},
{
q:
"What is the difference between inline, embedded and linked style sheets?",
a:
"Inline Style Sheet is used to style only a small piece of code. Embedded style sheets are put between the <head> and </head> tags. Linked style sheet is used to apply the style to all the pages within your website by linking an external style sheet to the html document."
},
{
q: 'What does the CSS property "box-sizing":"border-box" do?',
a:
"It alters the default CSS box model used to calculate width and height of the elements to include any border and padding in the value you specify for width and height."
},
{
q: 'What is the default display value of a div element?',
a: "display: block;"
}
]
},
// CSS: Pseudo-classes
// Source: https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
{
title: "CSS: Pseudo-classes",
image: "../style/images/css3.svg",
cards: [
{
q: "What is a CSS Pseudo-class?",
a:
'A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s) such as ":hover".'
},
{
q: "What is the general CSS Pseudo-class syntax?",
a:
"For example, one creates rules like this: selector:pseudo-class { property: value; }"
},
{
q: "How are pseudo-classes used to style elements?",
a:
"Pseudo-classes style elements in relation to the history of the navigator (like :link for <a>), content status (like :focus on input forms), and mouse position (like :hover)."
},
{
q:
"What are the standard pseudo-classes for styling <a> link states?",
a:
"a:link - a normal, unvisited link, a:visited, a:hover - when one mouses over the link, and a:active - moment the link is clicked"
},
{
q:
"What are some pseudo-classes for the status of the content such as inputs, checkboxes, etc.?",
a:
"One can use :checked, :active, :focus, :disabled, :enabled, :hover, :required, etc."
},
{
q:
"What are some helpful pseudo-classes for selecting specific DOM elements such as the first child, last child, etc.?",