Monday, 8 May 2017

Upwork 2017 CSS Test Questions and Answers


1. Which of the following code snippets when inserted into CSS will change the A and B div’s color from red to blue?
Answers:
 a. In style rule add this code “#sectors > div:not(.C):not(.D):not(.E) {background-color: blue;}”
b. In style rule add this code “#sectors > div:not(.C, .D, .E) {background-color: blue;}”
c. Both A and B
d. None of the above


2. Which of the following will create a triangle effect using pure CSS3 on a white background, without making use of background images?
Answers:
a. It is not possible to do so.
 
b. border-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 20px; width: 0px; height: 0px;
c. background-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 20px; width: 0px; height: 0px;
d. background-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 1px; width: 10px; height: 10px;


3. Can a percentage value be given in a ruby-align property?
Answers:
a. Yes

b. No
4. Consider the following font definition:
font-weight:normal
What is the other way of getting the same result?
Answers:
a. font-weight:100
b. font-weight:900

 c. font-weight:400
d. font-weight:700


5. Consider the following code:
div[class^=”stronger”] { } {em }
Which of the following statements is true?
Answers:
 a. It applies the rule only on divs who belong to a class that begins with “stronger”.
b. It applies the rule only on divs of class “stronger”.
c. It applies the rule only on divs who belong to a class which end with “stronger”.
d. It applies the rule only on divs who belong to a class which does not contain “stronger” in its name.


6. For the clear property, which of the following values is not valid?
Answers:
a. none
b. left
c. right
 
d. top
7. What will be the output of the following code?

Lorem
Answers:
a. The text “Lorem” will be colored black-red.
b. The div element will be colored black-red.

 c. The border of div element will be colored black-red.
d. None of these.


8. Which of the following is not a valid value for the font-smooth property?
Answers:
a. auto
b. never
c. always

 d. normal
e. length


9. Which of the following option does not exist in media groups available in CSS3?
Answers:
a. continuous or paged
b. visual or tactile
c. grid or bitmap

  d. braille or screen
10. Which of the following is not a valid page break?
Answers:
a. page-break-inside

 b. page-break-outside
c. page-break-before
d. page-break-after
e. None of these


11. Which statement is correct given the following? box-shadow:30px 20px 10px 5px black;
Answers:
a. The shadow will be spread out to 30px top, 20px right, 10px bottom, 5px left.

b. The position of the horizontal black shadow is 30px and the position of the vertical black shadow is 20px and blur distance is 10px and size of shadow is 5px.
c. The position of the vertical black shadow is 30px and the position of the horizontal black shadow is 20px and size of shadow is 10px and blur distance is 5px.
d. The shadow will be spread out to 30px top and bottom, 20px left and right with 10px blur distance, 5px shadow size.


12. The min-width property cannot be applied to the following element:
Answers:
a. button
b. span

 c. table row
13. Given the following problem:
A drop shadow needs to appear only at the bottom, and no images should be used. Consider the following code:
-moz-box-shadow: 0px 4px 4px #000; -webkit-box-shadow: 0px 4px 4px #000; box-shadow-bottom: 5px #000;
However, this produces shadows on the rest of the element.
Which of the following code snippets will correct the issue?
Answers:
a. border-bottom:5px solid #ffffff; -webkit-box-shadow: 0px 5px #000000; -moz-box-shadow: 0px 5px #000000; box-shadow: 0px 5px #000000;

 b. -webkit-box-shadow: 0 4px 4px -2px #000000; -moz-box-shadow: 0 4px 4px -2px #000000; box-shadow: 0 4px 4px -2px #000000;
c. -webkit-box-shadow: 0 4px 4px -2px inside #000000; -moz-box-shadow: 0 4px 4px -2px inside #000000; box-shadow: 0 4px 4px -2px inside #000000;
d. None of these.


14. Consider the following code:
body { text-replace: “a” “b” “b” “c” }
What will be the output of the following string if the text-replace style is implemented?
andy lives behind cafe
Answers:
a. ndy lives behind cbfe

 b. cndy lives cehind ccfe
c. andy lives behind cafe
d. andy lives cehind bafe


15. What is the default value of the transform-style property?
Answers:
a. preserve-3d

b. flat
c. none
d. preserve


16. What will be the output of the following code?



Lorem
Answers:
a. The text “Lorem” will be colored black-red.
b. The div element will be colored black-red.

  c. The border of div element will be colored black-red.
d. None of these.


17. Which of the following styles is not valid for an image?
Answers:
a. img { float= left }
b. img { float: left here }
c. img { background: “black” }
d. img { border-width: 10 }

  e. All of the above
18. Suppose that a tag has 10tags. In this case which statement is correct given the following? td:nth-child(3n+0){ background-color: orange; }
Answers:
a. It returns a syntax error.
b. The background color of the fourth td will be orange.
a. The background color of the third td will be orange.

  c. The background color of every third td will be orange.
19. What is the best method to select all elements except for the last one in an unordered list?
Answers:
a. Adding a class to each
b.element but last

 c. Using li:not(:last-child) css selector
d. Using li:last-child selector
e. None of the above


20. Which of the following will apply a black inner glow with 25% opacity to a page element?
Answers:
a. box-shadow: 0 0 8px rgba(255,255,255, 0.25);

 b. box-shadow: inset 0 0 8px rgba(0,0,0, 0.25);
c. box-shadow: 0 0 8px rgba(255,255,255, 25%);
d. box-shadow: inset 0 0 8px rgba(0,0,0, 25%);


21. Which of the following is the initial value for the column-fill property?
Answers:
a. auto

b. balance
c. none


22. Which of the following can be used to add a shadow around the div element below?

Lorem ipsum
Answers:
  a. box-shadow: 0 0 8px 2px #888;
b. border-shadow: 0 0 8px 2px #888;
c. div-shadow: 8px 2px 0 0 #888;
d. None of these


23. Which of the following will decrease 50px from a DIV element whose width is 100%?
Answers:
 a. width: calc(100% – 50px);
b. width: reduce(100% – 50px);
c. width: decrease(100% – 50px);
d. width: 100% – 50px;


24. Which of the following properties specifies the minimum number of lines of a paragraph that must be left at the bottom of a page?
Answers:
 a. orphans
b. widows
c. bottom
d. overflow
e. None of these


25. What is the maximum value that can be given to the voice-volume property?
Answers:
a. 10

 b. 100
c. 500
d. None of the above


26. What is the initial value of the font-size property?
Answers:
a. small

 b. medium
c. large
d. default


27. Is there a way to create a pure CSS3 text color gradient?
Answers:
a. Yes, using the text-gradient property.
b. Yes, but only for headings.

c. There is no way to do a text color gradient with CSS3.
d. None of the above.


28. Consider the following code:
border-opacity:0.7;
Given a div element that needs to have a transparent red border, which of the following code samples will work in conjunction with the code above to accomplish the requirement?
Answers:
  a. border: 1px solid rgba(255, 0, 0, 0.7);
b. border: 1px solid rgb(255, 0, 0, 0.7);
c. border: 1px solid rgba(255, 255, 0, 0.7);
d. border: 1px solid red; opacity: 0.7;


29. What is the initial value of the animation-iteration-count property?
Answers:
 a. 1
b. 5
c. None


30. What is the default value of the animation-direction property?
Answers:
a. none

b. normal
c. alternate
d. inherited


31. Is it possible to combine a background image and CSS3 gradients?
Answers:
a. It is possible only when two separate styles are used, “background-image” and “gradient”, on an HTML tag.

  b. It is possible only when “background-image” is used.
c. It is possible only when layered HTML tags are used, “background-image” and “gradient”.
d. It is not possible to combine a background image and CSS3 gradients.


32. What will happen if the cursor property value is set to none?
Answers:
a. The default cursor will be displayed.

  b. No cursor will be displayed.
c. A pointer cursor will be displayed.
d. A text cursor will be displayed.


33. What will be the outcome of given code? div[class^=”stronger”] { } { }
Answers:
  a. It applies the rule only on divs who belong to a class that begins with “stronger”.
b. It applies the rule only on divs of class “stronger”.
c. It applies the rule only on divs who belong to a class which end with “stronger”.
d. It applies the rule only on divs who belong to a class which does not contain “stronger” in its name.


34. To apply style on every input element except text, which of the following selectors should be used?
Answers:
a. input:([!type=’text’])

 b. input:not([type=”text”])
c. input:not([type!=”text”])
d. input:([type!=’text’])


35. For the clear property, which of the following value is not valid?
Answers:
a. none
b. left
c. right

 d. top
36. Read the following:
@page rotated {size: landscape} TABLE {page: rotated; page-break-before: right}
What will this code do?
Answers:
  a. It will put all tables on a right-hand side landscape page.
b. It will rotate the page if the table is positioned at the right side.
c. It will keep the table in the landscape position and rotate the page.
d. None of the above


37. What is the initial value of the opacity property?
Answers:
 a. 1
b. normal
c. none


38. State whether the following statement is true or false.
If a parent element display property is set to none, its children too will not be rendered.
Answers:
 a. True
b. False


39. Which of the following filters does SVG support?
Answers:
a. SVG supports only CSS filters.

 b. SVG supports CSS filters as well as ‘filter’ property of SVG
c. SVG supports only ‘filter’ property of SVG
d. SVG does not supports any filters


40. What will happen if the pause property is used as follows?
h2 { pause: 40s 60s }
Answers:
 a. pause-before will be set to 40 seconds and pause-after will be set to 60 seconds.
b. pause-after will be set to 40 seconds and pause-before will be set to 60 seconds.
c. pause-after and pause-before will be set to 40 seconds.
d. pause-after and pause-before will be set to 60 seconds.


41. Which of the following properties allow percentages in their value fields?
Answers:
  a. font-size
b. font-variant
c. font-weight
d. line-height


42. Which of the following is not a valid value for the font-stretch property?
Answers:
a. condensed
b. normal

 a. semi-narrower
c. expanded
d. semi-expanded


43. Which of the following styles is valid?
Answers:
a. order: “none”;
b. order= “none”;
c. order: none;
d. order= none;

 e. None of these.
44. Which one of the following is appropriate to mirror/flip text by using CSS3?
Answers:
  a. .mirror_text{ -moz-transform: scaleX(-1); -o-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); filter: FlipH; -ms-filter: “FlipH”; }
b. .mirror_text{ Box-reflect; 20px right; }
c. .mirror_text{ Box-reflect; 20px left; }
d. .mirror_text{ -moz-transform: rotate(-180deg); -webkit-transform: rotate(-180deg); transform: rotate(-180deg); }


45. What is the initial value of the marquee-speed property?
Answers:
a. slow

 b. normal
c. fast
d. none


46. Which of the following will apply a gradient transition to #DemoGradient using CSS3?
Answers:
a. @-webkit-keyframes pulse #DemoGradient { 0% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(196,222,242)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } 50% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(222,252,255)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } 100% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(196,222,242)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } }

b. #DemoGradient{ background: -webkit-linear-gradient(#C7D3DC,#5B798E); background: -moz-linear-gradient(#C7D3DC,#5B798E); background: -o-linear-gradient(#C7D3DC,#5B798E); background: linear-gradient(#C7D3DC,#5B798E); -webkit-transition: background 1s ease-out; -moz-transition: background 1s ease-out; -o-transition: background 1s ease-out; transition: background 1s ease-out; background-size:1px 200px; border-radius: 10px; border: 1px solid #839DB0; cursor:pointer; width: 150px; height: 100px; } #DemoGradient:Hover{ background-position:100px; }
c. It is not possible to apply a gradient transition using only CSS3.


47. Using height on transitions is not possible with:
Answers:
  a. height:auto
b. height:100%
c. height:0
d. max-height:100%


48. Consider the following problem: When trying to apply a CSS3 style to a label of a checked radio button like this: ….
….
This does not produce the desired effect. Which of the following snippets will correct issue?
Answers:
a. It is not possible to style.
b. <label “rad”>A Label

 c. input[type=”radio”]:checked+label{ font-weight: bold; }
d. input[type=”radio”]:checked@label{ font-weight: bold; }


49. There are various types of input fields in a HTML page. Choose the appropriate CSS3 code which will have an effect on all inputs, except checkbox and radio.
Answers:
a. form input:not([type=”radio”], [type=”checkbox”]) { }

  b. input:not([type=”radio”]):not([type=”checkbox”]) { }
c. input:not([type=”radio & checkbox”]) { }
d. input:!([type=”radio”]) , input:!([type=”checkbox”]) { }


50. Is it possible to use transition animations with a gradient background?
Answers:
a. Yes

  b. No
51. What is the difference between float:left; vs display:inline-block; ?
Answers:
a. There is no difference, both of them have the same results.

 b. display:inline-block; adds whitespace between the elements.
c. float:left; collapses the parent element on itself.
d. None of these.


52. What is the range of values (in decimal notation) that can be specified in the RGB color model?
Answers:
a. 0 to 256

b. 0 to 255
c. -250 to 250
d. -255 to 255


53. Which of the following are not valid values for the target-new property?
Answers:
a. window
b. tab
c. none

  d. parent
e. current


54. What will be the output of the following rule?
em { color: rgba(0,0,255,1) }
Answers:
a. Opacity 1 with solid red color
b. Opacity 0 with solid blue color
c. Opacity 0 with solid red color

  d. Opacity 1 with solid blue color
e. None of these


55. While rendering the following code, what is the role of “src” propery?
@font-face { font-family: “calibriforh1”; src: local(“calibri”), url(calibri.woff); } h1 { font-family: “calibriforh1”, arial, sans-serif; }
Answers:
  a. It’s for searching the user’s system for a “calibri” font, and if it does not exist, it will load the font from the server instead.
b. It’s for searching the user’s system for a “calibri” font, and if it does not exist, it will load user’s system’s default font instead.
c. It’s for loading the user’s system’s default font.
d. None of these.


56. Which of the following statements is true with regard to CSS3 transitions?
Answers:
a. Using CSS transitions will slow down page upload and produce lag.

  b. The completion of a CSS transition generates a corresponding DOM event. An event is fired for each property that undergoes a transition. This allows a content developer to perform actions that synchronize with the completion of a transition.
c. CSS transitions allow DOM events in CSS values to occur smoothly over a specified duration.
d. None of these.


57. Given that one div element needs to be hidden and on active state needs to be displayed, what will be the output of the following code?
div { display: none; -webkit-transition: opacity 1s ease-out; opacity: 0; }
div.active { opacity: 1; display: block; }
Answers:
  a. On active state the element is displayed.
b. On active state the element’s opacity is changed to 1.
c. On active state the element’s opacity is changed to 0.
d. Nothing will be shown.


58. Which of the given options is/are equivalent to the following rule?
DIV { line-height: 1.2; font-size: 10pt }
Answers:
  a. DIV { line-height: 1.2em; font-size: 10pt }
b. DIV { line-height: 12em; font-size: 10pt }
c. DIV { line-height: 120%; font-size: 10pt }
d. DIV { line-height: 20%; font-size: 10pt }
e. DIV { line-height: 80%; font-size: 10pt }


59. What will happen if the following style declaration is applied to an element?
p { margin: 3em 2em }
Answers:
  a. The top and the bottom margins will be 3em and the left and the right margins will be 2em.
b. The top and the bottom margins will be 2em and the left and the right margins will be 3em.
c. The top and the left margins will be 3em and the bottom and the right margins will be 2em.
d. The top and the right margins will be 2em and the bottom and the left margins will be 3em.


60. Suppose there are 16

elements and a style needs to applied only on every 4th element. Which of the following is correct?
Answers:
a. div:nth-child(4), div:nth-child(8), div:nth-child(12), div:nth-child(16) { }
b. div:nth-child(4n) { }

  c. div:nth-child(4n+4) { }
d. div:nth-child(3n+4)


Saturday, 26 March 2016

Upwork PHP Test Answers 2015-16




1. What will be the output of the following code? <? echo 5 * 6 / 2 + 2 * 3; ?>
Answers:
  1. 1
  2. 20
  3. 21
  4. 23
  5. 34
  6.  
2. Which of the following methods should be used for sending an email using the variables $to, $subject, and $body?
Answers:
  1. mail($to,$subject,$body)
  2. sendmail($to,$subject,$body)
  3. mail(to,subject,body)
  4. sendmail(to,subject,body)
3. Which of the following is used to maintain the value of a variable over different pages?
Answers:
  1. static
  2. global
  3. session_register()
  4. None of these
4. Which of the following will check if a function exists?
Answers:
  1. function_exists()
  2. has_function()
  3. $a = “function to check”; if ($a ()) // then function exists
  4. None of these
5. Which of the following is not a file-related function in PHP?
Answers:
  1. fclose
  2. fopen
  3. fwrite
  4. fgets
  5. fappend
6. Which of the following is true about the singleton design pattern?
Answers:
  1. A singleton pattern means that a class will only have a single method.
  2. A singleton pattern means that a class can have only one instance object.
  3. A singleton pattern means that a class has only a single member variable.
  4. Singletons cannot be implemented in PHP.
7. Which of the following characters are taken care of by htmlspecialchars?
Answers:
  1. <
  2. >
  3. single quote
  4. double quote
  5. &
  6. All of these
8. Which of the following will read an object into an array variable?
Answers:
  1. $array_variable = get_object_vars($object);
  2. $array_variable = (array)$object;
  3. $array_variable = array $object;
  4. $array_variable = get_object_vars $object;
9. Which of the following variable declarations within a class is invalid in PHP?
Answers:
  1. private $type = ‘moderate’;
  2. internal $term = 3;
  3. public $amnt = ‘500’;
  4. protected $name = ‘Quantas Private Limited’;
10. Which of the following is not a PHP magic constant?
Answers:
  1. __FUNCTION__
  2. __TIME__
  3. __FILE__
  4. __NAMESPACE__
  5. __CLASS__
11. Which of the following will print out the PHP call stack?
Answers:
  1. $e = new Exception; var_dump($e->debug());
  2. $e = new Exception; var_dump($e->getTraceAsString());
  3. $e = new Exception; var_dump($e->backtrace());
  4. $e = new Exception; var_dump($e->getString());
12. What will be the output of the following code? <?php var_dump (3*4); ?>
Answers:
  1. int(3*4)
  2. int(12)
  3. 3*4
  4. 12
  5. None of the above
13. Which of the following is correct about Mysqli and PDO?
Answers:
  1. Mysqli provides the procedural way to access the database while PDO provides the object oriented way.
  2. Mysqli can only be used to access MySQL database while PDO can be used to access any DBMS.
  3. MySQLi prevents SQL Injection whereas PDO does not.
  4. MySQLi is used to create prepared statements whereas PDO is not.
14. What is the correct way to send a SMTP (Simple Mail Transfer Protocol) email using PHP?
Answers:
  1. s.sendmail($EmailAddress, [$MessageBody], msg.as_string())
  2. sendmail($EmailAddress, “Subject”, $MessageBody);
  3. mail($EmailAddress, “Subject”, $MessageBody);
  4. <a href=”mailto:$EmailAddress”>$MessageBody</a>
15. Which of the following will start a session?
Answers:
  1. session(start);
  2. session();
  3. session_start();
  4. login_sesion();
16. For the following code: <?php
function Expenses() { function Salary() { }
function Loan() { function Balance() { } } }
?> Which of the following sequence will run successfully?
Answers:
  1. Expenses();Salary();Loan();Balance();
  2. Salary();Expenses();Loan();Balance();
  3. Expenses();Salary();Balance();Loan();
  4. Balance();Loan();Salary();Expenses();
17. What enctype is required for file uploads to work?
Answers:
  1. multipart/form-data
  2. multipart
  3. file
  4. application/octect-stream
  5. None of these
18. Which one of the following is not an encryption method in PHP?
Answers:
  1. crypt()
  2. md5()
  3. sha1()
  4. bcrypt()
19. What function should you use to join array elements with a glue string?
Answers:
  1. join_st
  2. implode
  3. connect
  4. make_array
  5. None of these

20. What is the string concatenation operator in PHP?
Answers:
  1. +
  2. ||
  3. .
  4. |||
  5. None of these

21. Which of the following will store order number (34) in an ‘OrderCookie’?
Answers:
  1. setcookie(“OrderCookie”,34);
  2. makeCookie(“OrderCookie”,34);
  3. Cookie(“OrderCookie”,34);
  4. OrderCookie(34);

22. What is the correct line to use within the php.ini file, to specify that 128MB would be the maximum amount of memory that a script may use?
Answers:
  1. memory_limit = 128M
  2. limit_memory = 128M
  3. memory_limit: 128M
  4. limit_memory: 128M
23. What is the best way to change the key without changing the value of a PHP array element?
Answers:
  1. $arr[$newkey] = $oldkey; unset($arr[$oldkey]);
  2. $arr[$newkey] = $arr[$oldkey]; unset($arr[$oldkey]);
  3. $newkey = $arr[$oldkey]; unset($arr[$oldkey]);
  4. $arr[$newkey] = $oldkey.GetValue(); unset($arr[$oldkey]);
24. Which function can be used to delete a file?
Answers:
      a. delete()
      b. delete_file()
      c. unlink()
      d. fdelete()
      e. file_unlink()

25.   Which one is correct?
  1. $s = fwrite (“a string here”);
  2. $s = fwrite ($fp,”a string here”);
  3. $s = fwrite (“a string here”,$fp);
  4. non of the above
26.   Which of the following set of operations is not valid in PHP 5?
  1. >, >=
  2. =,==
  3. !==,!==
  4. +=, *=
27.   Late PHP version support remote file accessing for the functions:
  1. include()
  2. include_once()
  3. require_once()
  4. All of the above
  28.  What will be the output of the following script?
$count=50;
function Argument()
{
$count++;
echo $count;
}
Argument()
?>
  1. It will print 50
  2. It will print 51
  3. It will print 52
  4. It will print 1
29.   which of the following are used for code reuse?
  1. Loops
  2. functions
  3. Database
  4. include files
 30.   You need to keep an eye on the existing number of objects of a given class without introducing a non-class varibale. which of the following makes this happen?
  1. Add a member varibale that gets incremented in the default constructer and decremented the destructer.
  2. Add a local variable that gets incremented in each constructer and decremented in the desructer
  3. Add a static member variable that gets incremented in each constructer and decreented in the destructor
  4. This cannot be accomplished since the creation of objects is being done dynamically via “new”