\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Lilava} \pdfinfo{ /Title (php-test.pdf) /Creator (Cheatography) /Author (Lilava) /Subject (PHP test Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{C36FC9} \definecolor{LightBackground}{HTML}{F7EDF8} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{PHP test Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Lilava} via \textcolor{DarkBackground}{\uline{cheatography.com/64138/cs/16221/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Lilava \\ \uline{cheatography.com/lilava} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 10th July, 2018.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{class interface}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following is correct? (Choose 2) \newline % Row Count 1 (+ 1) A. A class can extend more than one class. \newline % Row Count 2 (+ 1) B. A class can implement more than one class. \newline % Row Count 3 (+ 1) C. A class can extend more than one interface. \newline % Row Count 4 (+ 1) D. A class can implement more than one interface. \newline % Row Count 5 (+ 1) E. An interface can extend more than one interface. \newline % Row Count 7 (+ 2) F. An interface can implement more than one interface.% Row Count 9 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D,E} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{DB}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{You'd like to use the class MyDBConnection that's defined in the \newline % Row Count 2 (+ 2) MyGreatFramework\textbackslash{}MyGreatDatabaseAbstractionLayer namespace, but you want to \newline % Row Count 4 (+ 2) minimize {\emph{as much as possible}} the length of the class name you have to type. What would \newline % Row Count 6 (+ 2) you do? \newline % Row Count 7 (+ 1) A. Import the MyGreatFramework namespace \newline % Row Count 8 (+ 1) B. Import the MyGreatFramework\textbackslash{}MyGreatDatabaseAbstractionLayer namespace \newline % Row Count 10 (+ 2) C. Alias MyGreatFramework\textbackslash{}MyGreatDatabaseAbstractionLayer\textbackslash{}MyDBConnection to a shorter name \newline % Row Count 12 (+ 2) D. Alias MyGreatFramework\textbackslash{}MyGreatDatabaseAbstractionLayer to a shorter name% Row Count 14 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JSON convert}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Given a PHP value, which sample shows how to convert the value to JSON? \newline % Row Count 2 (+ 2) A. \$string = json\_encode(\$value); \newline % Row Count 3 (+ 1) B. \$string = Json::encode(\$value); \newline % Row Count 4 (+ 1) C. \$json = new Json(\$value); \$string = \$json-\textgreater{}\_\_toString(); \newline % Row Count 6 (+ 2) D. \$value = (object) \$value; \$string = \$value-\textgreater{}\_\_toJson();% Row Count 8 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JSON convert}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Given a JSON-encoded string, which code sample correctly indicates how to decode the \newline % Row Count 2 (+ 2) string to native PHP values? \newline % Row Count 3 (+ 1) A. \$json = new Json(\$jsonValue); \$value = \$json-\textgreater{}decode(); \newline % Row Count 5 (+ 2) B. \$value = \seqsplit{Json::decode(\$jsonValue);} \newline % Row Count 6 (+ 1) C. \$value = \seqsplit{json\_decode(\$jsonValue);} \newline % Row Count 7 (+ 1) D. \$value = \seqsplit{Json::fromJson(\$jsonValue);}% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{query}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{When a query that is supposed to affect rows is executed as part of a transaction, and \newline % Row Count 2 (+ 2) reports no affected rows, it could mean that: (Choose 2) \newline % Row Count 4 (+ 2) A. The transaction failed \newline % Row Count 5 (+ 1) B. The transaction affected no lines \newline % Row Count 6 (+ 1) C. The transaction was rolled back \newline % Row Count 7 (+ 1) D. The transaction was committed without error% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A,B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{sql}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Transactions should be used to: (Choose 2) \newline % Row Count 1 (+ 1) A. Prevent errors in case of a power outage or a failure in the SQL connection \newline % Row Count 3 (+ 2) B. Ensure that the data is properly formatted \newline % Row Count 4 (+ 1) C. Ensure that either all statements are performed properly, or that none of them are. \newline % Row Count 6 (+ 2) D. Recover from user errors% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A,C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{msql}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Consider the following table data and PHP code. What is the outcome? \newline % Row Count 2 (+ 2) Table data (table name "users" with primary key "id"): \newline % Row Count 4 (+ 2) id name email \newline % Row Count 5 (+ 1) -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-- \newline % Row Count 6 (+ 1) 1 anna alpha@example.com \newline % Row Count 7 (+ 1) 2 betty beta@example.org \newline % Row Count 8 (+ 1) 3 clara gamma@example.net \newline % Row Count 9 (+ 1) 5 sue sigma@example.info \newline % Row Count 10 (+ 1) PHP code(assume tha PDO connection is correctly established): \newline % Row Count 12 (+ 2) \$dsn = 'mysql:host = localhost;dbname=exam': \newline % Row Count 13 (+ 1) \$user = 'username'; \newline % Row Count 14 (+ 1) \$pass = '{\bf{{\emph{}}}}*'; \newline % Row Count 15 (+ 1) \$pdo - new PDO(\$dsn, \$user, \$pass); \newline % Row Count 16 (+ 1) \$cmd = 'SELECT * FOM users WHERE id= :id"; \newline % Row Count 17 (+ 1) \$stmt = \$pdo-\textgreater{}prepare(\$cmd); \newline % Row Count 18 (+ 1) \$id = 3; \newline % Row Count 19 (+ 1) \$stmt -\textgreater{} bindParam('id', \$id); \newline % Row Count 20 (+ 1) \$stmt-\textgreater{}execute(); \newline % Row Count 21 (+ 1) \$stmt-\textgreater{} bindColumn(3, \$result); \newline % Row Count 22 (+ 1) \$row = \$stmt-\textgreater{} fetch(PDO ::FETCH\_BOUND); \newline % Row Count 23 (+ 1) A. Database will return no rows \newline % Row Count 24 (+ 1) B. The vaule of \$row will be an array \newline % Row Count 25 (+ 1) C. The vaule of \$result will be empty \newline % Row Count 26 (+ 1) D. The value of \$result will be 'gamma@example.net'% Row Count 28 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{msql}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the preferred method for preventing SQL injection? \newline % Row Count 2 (+ 2) A. Always using prepared statements for all SQL queries. \newline % Row Count 4 (+ 2) B. Always using the available database-specific escaping functionality on all variables prior to building the SQL query. \newline % Row Count 7 (+ 3) C. Using addslashes() to escape variables to be used in a query. \newline % Row Count 9 (+ 2) D. Using htmlspecialchars() and the available database-specific escaping functionality to escape variables to be used in a query.% Row Count 12 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Consider the following table data and PHP code. What is a possible outcome? \newline % Row Count 2 (+ 2) Table data (table name "users" with primary key "id"): \newline % Row Count 4 (+ 2) id name email \newline % Row Count 5 (+ 1) -{}-{}-{}-{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}-{}-{}-- -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}- \newline % Row Count 6 (+ 1) 1 anna alpha@example.com \newline % Row Count 7 (+ 1) 2 betty beta@example.org \newline % Row Count 8 (+ 1) 3 clara gamma@example.net \newline % Row Count 9 (+ 1) 5 sue sigma@example.info \newline % Row Count 10 (+ 1) PHP code (assume the PDO connection is correctly established): \newline % Row Count 12 (+ 2) \$dsn = \seqsplit{'mysql:host=localhost;dbname=exam';} \newline % Row Count 13 (+ 1) \$user = 'username'; \newline % Row Count 14 (+ 1) \$pass = '{\bf{{\emph{}}}}**'; \newline % Row Count 15 (+ 1) \$pdo = new PDO(\$dsn, \$user, \$pass); \newline % Row Count 16 (+ 1) \$cmd = "SELECT name, email FROM users LIMIT 1"; \newline % Row Count 17 (+ 1) \$stmt = \$pdo-\textgreater{}prepare(\$cmd); \newline % Row Count 18 (+ 1) \$stmt-\textgreater{}execute(); \newline % Row Count 19 (+ 1) \$result = \$stmt-\textgreater{}fetchAll(PDO::FETCH\_BOTH); \newline % Row Count 20 (+ 1) \$row = \$result{[}0{]}; \newline % Row Count 21 (+ 1) A. The value of \$row is `array(0 =\textgreater{} 'anna', 1 =\textgreater{} 'alpha@example.com')`. \newline % Row Count 23 (+ 2) B. The value of \$row is `array('name' =\textgreater{} 'anna', 'email' =\textgreater{} 'alpha@example.com')`. \newline % Row Count 25 (+ 2) C. The value of \$row is `array(0 =\textgreater{} 'anna', 'name' =\textgreater{} 'anna', 1 =\textgreater{} 'alpha@example.com', 'email' =\textgreater{} 'alpha@example.com')`. \newline % Row Count 28 (+ 3) D. The value of \$result is `array('anna' =\textgreater{} 'alpha@example.com')`.% Row Count 30 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Given the following code, what is correct? \newline % Row Count 1 (+ 1) function f(stdClass \&\$x = NULL) \{ \$x = 42; \} \newline % Row Count 2 (+ 1) \$z = new stdClass; \newline % Row Count 3 (+ 1) f(\$z); \newline % Row Count 4 (+ 1) var\_dump(\$z); \newline % Row Count 5 (+ 1) A. Error: Typehints cannot be NULL \newline % Row Count 6 (+ 1) B. Error: Typehints cannot be references \newline % Row Count 7 (+ 1) C. Result is NULL \newline % Row Count 8 (+ 1) D. Result is object of type stdClass \newline % Row Count 9 (+ 1) E. Result is 42% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : E} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{msql}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Consider the following table data and PHP code. What is the outcome? \newline % Row Count 2 (+ 2) Table data(table name "users" with primary key "id"): \newline % Row Count 4 (+ 2) id name email \newline % Row Count 5 (+ 1) -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-- \newline % Row Count 6 (+ 1) 1 anna alpha@example.com \newline % Row Count 7 (+ 1) 2 betty beta@example.org \newline % Row Count 8 (+ 1) 3 clara gmma@example.net \newline % Row Count 9 (+ 1) 5 sue sigma@example.info \newline % Row Count 10 (+ 1) PHP code(assume the PDO connection is correctly established ): \newline % Row Count 12 (+ 2) \$dsn = \seqsplit{'mysql:host=localhost;dbname=exam';} \newline % Row Count 13 (+ 1) \$user= 'username'; \newline % Row Count 14 (+ 1) \$pass = '{\bf{{\emph{}}}}'; \newline % Row Count 15 (+ 1) \$pdo = new PDO(\$dsn, \$user, \$pass); \newline % Row Count 16 (+ 1) try\{ \newline % Row Count 17 (+ 1) \$cmd = "INSER INTO users (id, name, email) VALUES (:id, :name, :email)"; \newline % Row Count 19 (+ 2) \$stmt = \$pdo -\textgreater{}prepare(\$cmd); \newline % Row Count 20 (+ 1) \$stmt -\textgreater{} bindValue('id', 1); \newline % Row Count 21 (+ 1) \$stmt -\textgreater{} bindValue('name', 'anna'); \newline % Row Count 22 (+ 1) \$stmt -\textgreater{} bindValue( 'email', 'alpha@example.com'); \newline % Row Count 24 (+ 2) \$stmt-\textgreater{}execute(); \newline % Row Count 25 (+ 1) echo "Succes!"; \newline % Row Count 26 (+ 1) \}catch (PDOException \$e)\{ \newline % Row Count 27 (+ 1) echo "Faliure!"; \newline % Row Count 28 (+ 1) throw \$e; \newline % Row Count 29 (+ 1) A.The INSERT will succeed and the user will see the "Success!" message \newline % Row Count 31 (+ 2) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{msql (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{B. The INSERT will fail because of a primary key violation, and user will see "Success!" message \newline % Row Count 2 (+ 2) C. The INSERT will fail because of a primary key violation , and the user will see a PDO warring message \newline % Row Count 5 (+ 3) D. The INSERT will fail because of a primary key vioaltion, and the user will see the "Faliure!" messsage% Row Count 8 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{msql}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{An unbuffered database query will: (Choose 2) \newline % Row Count 1 (+ 1) A. Return the first data faster \newline % Row Count 2 (+ 1) B. Return all data faster \newline % Row Count 3 (+ 1) C. Free connection faster for others scripts to use \newline % Row Count 5 (+ 2) D. Use less memory% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A,D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{msql}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Consider the following table data and PHP code, and assume that the database supports \newline % Row Count 2 (+ 2) transactions. What is the outcome? \newline % Row Count 3 (+ 1) Table data (table name "users" with primary key "id"): \newline % Row Count 5 (+ 2) id name email \newline % Row Count 6 (+ 1) -{}-{}-{}-{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}-{}-{}-- -{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}- \newline % Row Count 7 (+ 1) 1 anna alpha@example.com \newline % Row Count 8 (+ 1) 2 betty beta@example.org \newline % Row Count 9 (+ 1) 3 clara gamma@example.net \newline % Row Count 10 (+ 1) 5 sue sigma@example.info \newline % Row Count 11 (+ 1) PHP code (assume the PDO connection is correctly established): \newline % Row Count 13 (+ 2) \$dsn = \seqsplit{'mysql:host=localhost;dbname=exam';} \newline % Row Count 14 (+ 1) \$user = 'username'; \newline % Row Count 15 (+ 1) \$pass = '{\bf{{\emph{}}}}**'; \newline % Row Count 16 (+ 1) \$pdo = new PDO(\$dsn, \$user, \$pass); \newline % Row Count 17 (+ 1) try \{ \newline % Row Count 18 (+ 1) \$pdo-\textgreater{}exec("INSERT INTO users (id, name, email) VALUES (6, 'bill', \newline % Row Count 20 (+ 2) 'delta@example.com')"); \newline % Row Count 21 (+ 1) \$pdo-\textgreater{}begin(); \newline % Row Count 22 (+ 1) \$pdo-\textgreater{}exec("INSERT INTO users (id, name, email) VALUES (7, 'john', \newline % Row Count 24 (+ 2) \seqsplit{'epsilon@example.com')");} \newline % Row Count 25 (+ 1) throw new Exception(); \newline % Row Count 26 (+ 1) \} catch (Exception \$e) \{ \newline % Row Count 27 (+ 1) \$pdo-\textgreater{}rollBack(); \newline % Row Count 28 (+ 1) A. The user 'bill' will be inserted, but the user 'john' will not be. \newline % Row Count 30 (+ 2) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{msql (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{B. Both user 'bill' and user 'john' will be inserted. \newline % Row Count 2 (+ 2) C. Neither user 'bill' nor user 'john' will be inserted. \newline % Row Count 4 (+ 2) D. The user 'bill' will not be inserted, but the user 'john' will be.% Row Count 6 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{form techique}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{The following form is loaded in a browser and submitted, with the checkbox activated: \newline % Row Count 2 (+ 2) \textless{}form method="post"\textgreater{} \newline % Row Count 3 (+ 1) \textless{}input type="checkbox" name="accept" /\textgreater{} \newline % Row Count 4 (+ 1) \textless{}/form\textgreater{} \newline % Row Count 5 (+ 1) In the server-side PHP code to deal with the form data, what is the value of \newline % Row Count 7 (+ 2) \$\_POST{[}'accept'{]} ? \newline % Row Count 8 (+ 1) A. accept \newline % Row Count 9 (+ 1) B. ok \newline % Row Count 10 (+ 1) C. true \newline % Row Count 11 (+ 1) D. on% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{form techique}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{An HTML form has two submit buttons. After submitting the form, how can you determine \newline % Row Count 2 (+ 2) with PHP which button was clicked? \newline % Row Count 3 (+ 1) A. An HTML form may only have one button. \newline % Row Count 4 (+ 1) B. You cannot determine this with PHP only. You must use JavaScript to add a value to the URL depending on which button has been clicked. \newline % Row Count 7 (+ 3) C. Put the two buttons in different forms, but make sure they have the same name. \newline % Row Count 9 (+ 2) D. Assign name and value attributes to each button and use \$\_GET or \$\_POST to find out which button has been clicked.% Row Count 12 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{form techique}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{An HTML form contains this form element: \newline % Row Count 1 (+ 1) {[}6{]} \newline % Row Count 2 (+ 1) The user clicks on the image to submit the form. How can you now access the relative \newline % Row Count 4 (+ 2) coordinates of the mouse click? \newline % Row Count 5 (+ 1) A. \$\_FILES{[}'myImage'{]}{[}'x'{]} and \$\_FILES{[}'myImage'{]}{[}'y'{]} \newline % Row Count 7 (+ 2) B. \$\_POST{[}'myImage'{]}{[}'x'{]} and \$\_POST{[}'myImage'{]}{[}'y'{]} \newline % Row Count 9 (+ 2) C. \$\_POST{[}'myImage.x'{]} and \$\_POST{[}'myImage.y'{]} \newline % Row Count 10 (+ 1) D. \$\_POST{[}'myImage\_x'{]} and \$\_POST{[}'myImage\_y'{]}% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{form techique}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following techniques ensures that a value submitted in a form can only be yes \newline % Row Count 2 (+ 2) or no ? \newline % Row Count 3 (+ 1) A. Use a select list that only lets the user choose between yes and no . \newline % Row Count 5 (+ 2) B. Use a hidden input field that has a value of yes or no . \newline % Row Count 7 (+ 2) C. Enable the safe\_mode configuration directive. \newline % Row Count 8 (+ 1) D. None of the above.% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{constant}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What does the \_\_FILE\_\_ constant contain? \newline % Row Count 1 (+ 1) A. The filename of the current script. \newline % Row Count 2 (+ 1) B. The full path to the current script. \newline % Row Count 3 (+ 1) C. The URL of the request made. \newline % Row Count 4 (+ 1) D. The path to the main script.% Row Count 5 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class Base \{ \newline % Row Count 2 (+ 1) protected static function whoami() \{ \newline % Row Count 3 (+ 1) echo "Base "; \newline % Row Count 4 (+ 1) public static function whoareyou() \{ \newline % Row Count 5 (+ 1) static::whoami(); \newline % Row Count 6 (+ 1) class A extends Base \{ \newline % Row Count 7 (+ 1) public static function test() \{ \newline % Row Count 8 (+ 1) Base::whoareyou(); \newline % Row Count 9 (+ 1) self::whoareyou(); \newline % Row Count 10 (+ 1) parent::whoareyou(); \newline % Row Count 11 (+ 1) A. :whoareyou(); static::whoareyou(); \} public static function whoami() \{ echo "A "; \} \} class B extends A \{ public static function whoami() \{ echo "B "; \} \} \newline % Row Count 15 (+ 4) B. :test(); \newline % Row Count 16 (+ 1) C. B B B B B \newline % Row Count 17 (+ 1) D. Base A Base A B \newline % Row Count 18 (+ 1) E. Base B B A B \newline % Row Count 19 (+ 1) F. Base B A A B% Row Count 20 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) \$a = 3; \newline % Row Count 2 (+ 1) switch (\$a) \{ \newline % Row Count 3 (+ 1) case 1: echo 'one'; break; \newline % Row Count 4 (+ 1) case 2: echo 'two'; break; \newline % Row Count 5 (+ 1) default: echo 'four'; break; \newline % Row Count 6 (+ 1) case 3: echo 'three'; break; \newline % Row Count 7 (+ 1) A. one \newline % Row Count 8 (+ 1) B. two \newline % Row Count 9 (+ 1) C. three \newline % Row Count 10 (+ 1) D. four% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{How many elements doeas the array \$matches from the following code contain? \newline % Row Count 2 (+ 2) \$str = "The cat sat on the roof of their house."; \newline % Row Count 3 (+ 1) \$mathes = preg\_split("/(the)/i" , \$str, -1, \seqsplit{PREG\_SPLIT\_DELIM\_CAPTURE);} \newline % Row Count 5 (+ 2) A. 2 \newline % Row Count 6 (+ 1) B.3 \newline % Row Count 7 (+ 1) C.4 \newline % Row Count 8 (+ 1) D. 7 \newline % Row Count 9 (+ 1) E. 9% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class Number \{ \newline % Row Count 2 (+ 1) private \$v; \newline % Row Count 3 (+ 1) private static \$sv = 10; \newline % Row Count 4 (+ 1) public function \_\_construct(\$v) \{ \$this-\textgreater{}v = \$v; \} \newline % Row Count 6 (+ 2) public function mul() \{ \newline % Row Count 7 (+ 1) return static function (\$x) \{ \newline % Row Count 8 (+ 1) return isset(\$this) ? \$this-\textgreater{}v{\emph{\$x : self::\$sv}}\$x; \newline % Row Count 9 (+ 1) \}; \newline % Row Count 10 (+ 1) \$one = new Number(1); \newline % Row Count 11 (+ 1) \$two = new Number(2); \newline % Row Count 12 (+ 1) \$double = \$two-\textgreater{}mul(); \newline % Row Count 13 (+ 1) \$x = Closure::bind(\$double, null, 'Number'); \newline % Row Count 14 (+ 1) echo \$x(5); \newline % Row Count 15 (+ 1) A. 5 \newline % Row Count 16 (+ 1) B. 10 \newline % Row Count 17 (+ 1) C. 50 \newline % Row Count 18 (+ 1) D. Fatal error% Row Count 19 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{How many elements does the array \$pieces contain after the following piece of code has \newline % Row Count 2 (+ 2) been executed? \newline % Row Count 3 (+ 1) \$pieces = explode("/", "///"); \newline % Row Count 4 (+ 1) A. 0 \newline % Row Count 5 (+ 1) B. 3 \newline % Row Count 6 (+ 1) C. 4 \newline % Row Count 7 (+ 1) D. 5% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Given the following code, what will the output be: \newline % Row Count 2 (+ 2) trait MyTrait \{ \newline % Row Count 3 (+ 1) private \$abc = 1; \newline % Row Count 4 (+ 1) public function increment() \{ \newline % Row Count 5 (+ 1) \$this-\textgreater{}abc++; \newline % Row Count 6 (+ 1) public function getValue() \{ \newline % Row Count 7 (+ 1) return \$this-\textgreater{}abc; \newline % Row Count 8 (+ 1) class MyClass \{ \newline % Row Count 9 (+ 1) use MyTrait; \newline % Row Count 10 (+ 1) public function incrementBy2() \{ \newline % Row Count 11 (+ 1) \$this-\textgreater{}increment(); \newline % Row Count 12 (+ 1) \$this-\textgreater{}abc++; \newline % Row Count 13 (+ 1) \$c = new MyClass; \newline % Row Count 14 (+ 1) \$c-\textgreater{}incrementBy2(); \newline % Row Count 15 (+ 1) var\_dump(\$c-\textgreater{}getValue()); \newline % Row Count 16 (+ 1) A. Fatal error: Access to private variable MyTrait::\$abc from context MyClass \newline % Row Count 18 (+ 2) B. Notice: Undefined property MyClass::\$abc \newline % Row Count 19 (+ 1) C. int(2) \newline % Row Count 20 (+ 1) D. int(3) \newline % Row Count 21 (+ 1) E. NULL% Row Count 22 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the return value of the following code: substr\_compare("foobar", "bar", 3); \newline % Row Count 2 (+ 2) A. -1 \newline % Row Count 3 (+ 1) B. 1 \newline % Row Count 4 (+ 1) C. TRUE \newline % Row Count 5 (+ 1) D. 0 \newline % Row Count 6 (+ 1) E. FALSE% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class T \newline % Row Count 2 (+ 1) const A = 42 + 1; \newline % Row Count 3 (+ 1) echo T :: A; \newline % Row Count 4 (+ 1) A. 42 \newline % Row Count 5 (+ 1) B. 43 \newline % Row Count 6 (+ 1) C. parse error% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Consider the following code. What can be said about the call to file\_get\_contents? \newline % Row Count 2 (+ 2) \$getdata = "foo=bar"; \newline % Row Count 3 (+ 1) \$opts = array('http' =\textgreater{} \newline % Row Count 4 (+ 1) array( \newline % Row Count 5 (+ 1) 'method' =\textgreater{} 'POST', \newline % Row Count 6 (+ 1) 'header' =\textgreater{} 'Content-type: \seqsplit{application/x-www-form-urlencoded'}, \newline % Row Count 8 (+ 2) 'content' =\textgreater{} \$getdata \newline % Row Count 9 (+ 1) ); \newline % Row Count 10 (+ 1) \$context = \seqsplit{stream\_context\_create(\$opts);} \newline % Row Count 11 (+ 1) \$result = \seqsplit{file\_get\_contents('http://example}.com/submit.php', false, \$context); \newline % Row Count 13 (+ 2) A. A GET request will be performed on \seqsplit{http://example.com/submit.php} \newline % Row Count 15 (+ 2) B. A POST request will be performed on \seqsplit{http://example.com/submit.php} \newline % Row Count 17 (+ 2) C. An error will be displayed% Row Count 18 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Given the following array: \newline % Row Count 1 (+ 1) \$a = array(28, 15, 77, 43); \newline % Row Count 2 (+ 1) Which function will remove the value 28 from \$a? \newline % Row Count 3 (+ 1) A. array\_shift() \newline % Row Count 4 (+ 1) B. array\_pop() \newline % Row Count 5 (+ 1) C. array\_pull() \newline % Row Count 6 (+ 1) D. array\_unshift()% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{You want to access the 3rd character of a string, contained in the variable \$test. Which of \newline % Row Count 2 (+ 2) the following possibilites work? (Choose 2) \newline % Row Count 3 (+ 1) A. echo \$test(3); \newline % Row Count 4 (+ 1) B. echo \$test{[}2{]}; \newline % Row Count 5 (+ 1) C. echo \$test(2); \newline % Row Count 6 (+ 1) D. echo \$test\{2\}; \newline % Row Count 7 (+ 1) E. echo \$test\{3\};% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B,D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What will the \$array array contain at the end of this script? \newline % Row Count 2 (+ 2) function modifyArray (\&\$array) \newline % Row Count 3 (+ 1) foreach (\$array as \&\$value) \newline % Row Count 4 (+ 1) \$value = \$value + 1; \newline % Row Count 5 (+ 1) \$value = \$value + 2; \newline % Row Count 6 (+ 1) \$array = array (1, 2, 3); \newline % Row Count 7 (+ 1) modifyArray(\$array); \newline % Row Count 8 (+ 1) A. 2, 3, 4 \newline % Row Count 9 (+ 1) B. 2, 3, 6 \newline % Row Count 10 (+ 1) C. 4, 5, 6 \newline % Row Count 11 (+ 1) D. 1, 2, 3% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which line of code can be used to replace the INSERT comment in order to output "hello"? \newline % Row Count 2 (+ 2) class C \{ \newline % Row Count 3 (+ 1) public \$ello = 'ello'; \newline % Row Count 4 (+ 1) public \$c; \newline % Row Count 5 (+ 1) public \$m; \newline % Row Count 6 (+ 1) function \_\_construct(\$y) \{ \newline % Row Count 7 (+ 1) \$this-\textgreater{}c = static function(\$f) \{ \newline % Row Count 8 (+ 1) // INSERT LINE OF CODE HERE \newline % Row Count 9 (+ 1) \}; \newline % Row Count 10 (+ 1) \$this-\textgreater{}m = function() \{ \newline % Row Count 11 (+ 1) return "h"; \newline % Row Count 12 (+ 1) \}; \newline % Row Count 13 (+ 1) \$x = new C("h"); \newline % Row Count 14 (+ 1) \$f = \$x-\textgreater{}c; \newline % Row Count 15 (+ 1) echo \$f(\$x-\textgreater{}m); \newline % Row Count 16 (+ 1) A. return \$this-\textgreater{}m() . "ello"; \newline % Row Count 17 (+ 1) B. return \$f() . "ello"; \newline % Row Count 18 (+ 1) C. return "h". \$this-\textgreater{}ello; \newline % Row Count 19 (+ 1) D. return \$y . "ello";% Row Count 20 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) echo "1" + 2 * "0x02"; \newline % Row Count 2 (+ 1) A. 1 \newline % Row Count 3 (+ 1) B. 3 \newline % Row Count 4 (+ 1) C. 5 \newline % Row Count 5 (+ 1) D. 20 \newline % Row Count 6 (+ 1) E. 7% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class a \newline % Row Count 2 (+ 1) public \$val; \newline % Row Count 3 (+ 1) function renderVal (a \$a) \newline % Row Count 4 (+ 1) if (\$a) \{ \newline % Row Count 5 (+ 1) echo \$a-\textgreater{}val; \newline % Row Count 6 (+ 1) renderVal (null); \newline % Row Count 7 (+ 1) A. A syntax error in the function declaration line \newline % Row Count 9 (+ 2) B. An error, because null is not an instance of 'a' \newline % Row Count 11 (+ 2) C. Nothing, because a null value is being passed to renderVal() \newline % Row Count 13 (+ 2) D. NULL% Row Count 14 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Consider the following code: \newline % Row Count 1 (+ 1) \$result = \$value1 ??? \$value2; \newline % Row Count 2 (+ 1) Which operator needs to be used instead of ??? so that \$result equals \$value1 if \$value1 \newline % Row Count 4 (+ 2) evaluates to true, and equals \$value2 otherwise? Just state the operator as it would be \newline % Row Count 6 (+ 2) required in the code.% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer :} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What will the following code piece print? \newline % Row Count 1 (+ 1) echo strtr('Apples and bananas', 'ae', 'ea') \newline % Row Count 2 (+ 1) A. Applas end benenes \newline % Row Count 3 (+ 1) B. Epplas end benenes \newline % Row Count 4 (+ 1) C. Apples and bananas \newline % Row Count 5 (+ 1) D. Applas end bananas% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) echo '1' . (print '2') + 3; \newline % Row Count 2 (+ 1) A. 123 \newline % Row Count 3 (+ 1) B. 213 \newline % Row Count 4 (+ 1) C. 142 \newline % Row Count 5 (+ 1) D. 214 \newline % Row Count 6 (+ 1) E. Syntax error% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which string will be returned by the following function call? \newline % Row Count 2 (+ 2) \$test = '/etc/conf.d/wireless'; \newline % Row Count 3 (+ 1) substr(\$test, strrpos(\$test, '/')); // note that strrpos() is being called, and not strpos() \newline % Row Count 5 (+ 2) A. "" \newline % Row Count 6 (+ 1) B. "/wireless" \newline % Row Count 7 (+ 1) C. "wireless" \newline % Row Count 8 (+ 1) D. "/conf.d/wireless" \newline % Row Count 9 (+ 1) E. "/etc"% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class C \{ \newline % Row Count 2 (+ 1) public \$x = 1; \newline % Row Count 3 (+ 1) function \_\_construct() \{ ++\$this-\textgreater{}x; \} \newline % Row Count 4 (+ 1) function \_\_invoke() \{ return ++\$this-\textgreater{}x; \} \newline % Row Count 5 (+ 1) function \_\_toString() \{ return (string) -{}-\$this-\textgreater{}x; \} \newline % Row Count 7 (+ 2) \$obj = new C(); \newline % Row Count 8 (+ 1) echo \$obj(); \newline % Row Count 9 (+ 1) A. 0 \newline % Row Count 10 (+ 1) B. 1 \newline % Row Count 11 (+ 1) C. 2 \newline % Row Count 12 (+ 1) D. 3% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which interfaces could class C implement in order to allow each statement in the following \newline % Row Count 2 (+ 2) code to work? (Choose 2) \newline % Row Count 3 (+ 1) \$obj = new C(); \newline % Row Count 4 (+ 1) foreach (\$obj as \$x =\textgreater{} \$y) \{ \newline % Row Count 5 (+ 1) echo \$x, \$y; \newline % Row Count 6 (+ 1) A. Iterator \newline % Row Count 7 (+ 1) B. ArrayAccess \newline % Row Count 8 (+ 1) C. IteratorAggregate \newline % Row Count 9 (+ 1) D. ArrayObject% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A,C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{//s1.php \newline sesion\_start(); \newline sleep(1); \newline \newline //s2.php \newline sesion\_start(); \newline sleep(2); \newline \newline //s3.php \newline sesion\_start(); \newline sleep(3);} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Which of the following statements is true? (Choose two.) \newline A. The total execution time for all 3 requests will be the maximum of the longest sleep() call \newline B. The requests may be processed out of order \newline C. The requests are guaranteed to be executed in order \newline D. Concurrent requests will be blocked until the session lock is released \newline \newline Answer: A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{The following form is loaded in a recent browser and submitted, with the second select \newline % Row Count 2 (+ 2) option selected: \newline % Row Count 3 (+ 1) \textless{}form method="post"\textgreater{} \newline % Row Count 4 (+ 1) \textless{}select name="list"\textgreater{} \newline % Row Count 5 (+ 1) \textless{}option\textgreater{}one\textless{}/option\textgreater{} \newline % Row Count 6 (+ 1) \textless{}option\textgreater{}two\textless{}/option\textgreater{} \newline % Row Count 7 (+ 1) \textless{}option\textgreater{}three\textless{}/option\textgreater{} \newline % Row Count 8 (+ 1) \textless{}/select\textgreater{} \newline % Row Count 9 (+ 1) \textless{}/form\textgreater{} \newline % Row Count 10 (+ 1) In the server-side PHP code to deal with the form data, what is the value of \$\_POST{[}'list'{]} ? \newline % Row Count 12 (+ 2) A. 1 \newline % Row Count 13 (+ 1) B. 2 \newline % Row Count 14 (+ 1) C. two \newline % Row Count 15 (+ 1) D. null% Row Count 16 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which value will be assigned to the key 0 in the following code? \newline % Row Count 2 (+ 2) \$a = array(true, '0'=\textgreater{} false, false=\textgreater{}true );% Row Count 3 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: 1} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{What is the output? \newline \newline class Number \{ \newline private \$v = 0; \newline public function \_\_construct(\$v) \{ \$this-\textgreater{}v = \$v; \} \newline public function mul() \{ \newline return function (\$x) \{ return \$this-\textgreater{}v * \$x; \}; \newline \$one = new Number(1); \newline \$two = new Number(2); \newline \$double = \$two-\textgreater{}mul()-\textgreater{}bindTo(\$one); \newline echo \$double(5);} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: 5} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{How should class MyObject be defined for the following code to work properly? \newline % Row Count 2 (+ 2) Assume \newline % Row Count 3 (+ 1) \$array is an array and MyObject is a user-defined class. \newline % Row Count 5 (+ 2) \$obj = new MyObject(); \newline % Row Count 6 (+ 1) array\_walk(\$array, \$obj); \newline % Row Count 7 (+ 1) A. MyObject should extend class Closure \newline % Row Count 8 (+ 1) B. MyObject should implement interface Callable \newline % Row Count 9 (+ 1) C. MyObject should implement method \_\_call \newline % Row Count 10 (+ 1) D. MyObject should implement method \_\_invoke% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What will the following code print out? \newline % Row Count 1 (+ 1) \$str = '✔ one of the following'; \newline % Row Count 2 (+ 1) echo str\_replace('✔', 'Check', \$str); \newline % Row Count 3 (+ 1) A. Check one of the following \newline % Row Count 4 (+ 1) B. one of the following \newline % Row Count 5 (+ 1) C. \&\#10004; one of the following% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) var\_dump(boolval({[}{]})); \newline % Row Count 2 (+ 1) A. bool(true) \newline % Row Count 3 (+ 1) B. bool(false)% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Assuming UTF-8 encoding, what is the value of \$count? \newline % Row Count 2 (+ 2) \$data=`\$1a2`; \newline % Row Count 3 (+ 1) \$count = strlen(\$data); \newline % Row Count 4 (+ 1) A. 0 \newline % Row Count 5 (+ 1) B. 4 \newline % Row Count 6 (+ 1) C. 5 \newline % Row Count 7 (+ 1) D. 7% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: 5} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Given the following DateTime objects, what can you use to compare the two dates and \newline % Row Count 2 (+ 2) indicate that \$date2 is the later of the two dates? \newline % Row Count 4 (+ 2) \$date1 = new DateTime('2014-02-03'); \newline % Row Count 5 (+ 1) \$date2 = new DateTime('2014-03-02'); \newline % Row Count 6 (+ 1) A. \$date2 \textgreater{} \$date1 \newline % Row Count 7 (+ 1) B. \$date2 \< \$date1 \newline % Row Count 8 (+ 1) C. \$date1-\textgreater{}diff(\$date2) \< 0 \newline % Row Count 9 (+ 1) D. \$date1-\textgreater{}diff(\$date2) \textgreater{} 0% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) \$f = function () \{ return "hello"; \}; \newline % Row Count 2 (+ 1) echo gettype(\$f); \newline % Row Count 3 (+ 1) A. hello \newline % Row Count 4 (+ 1) B. string \newline % Row Count 5 (+ 1) C. object \newline % Row Count 6 (+ 1) D. function% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) \$a = array('a', 'b'=\textgreater{}'c'); \newline % Row Count 2 (+ 1) echo \seqsplit{property\_exists((object)} \$a, 'a')?'true':'false'; \newline % Row Count 4 (+ 2) echo '-'; \newline % Row Count 5 (+ 1) echo \seqsplit{property\_exists((object)} \$a, 'b')?'true':'false'; \newline % Row Count 7 (+ 2) A. false-false \newline % Row Count 8 (+ 1) B. false-true \newline % Row Count 9 (+ 1) C. true-false \newline % Row Count 10 (+ 1) D. true-true% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class Number \{ \newline % Row Count 2 (+ 1) private \$v = 0; \newline % Row Count 3 (+ 1) public function \_\_construct(\$v) \{ \$this-\textgreater{}v = \$v; \} \newline % Row Count 5 (+ 2) public function mul() \{ \newline % Row Count 6 (+ 1) return function (\$x) \{ return \$this-\textgreater{}v * \$x; \}; \newline % Row Count 7 (+ 1) \$one = new Number(1); \newline % Row Count 8 (+ 1) \$two = new Number(2); \newline % Row Count 9 (+ 1) \$double = \$two-\textgreater{}mul()-\textgreater{}bindTo(\$one); \newline % Row Count 10 (+ 1) echo \$double(5);% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : 5} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of this code? \newline % Row Count 1 (+ 1) \$world = 'world'; \newline % Row Count 2 (+ 1) echo \textless{}\textless{}\textless{}'TEXT' \newline % Row Count 3 (+ 1) hello \$world \newline % Row Count 4 (+ 1) TEXT; \newline % Row Count 5 (+ 1) A. hello world \newline % Row Count 6 (+ 1) B. hello \$world \newline % Row Count 7 (+ 1) C. PHP Parser error% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) function z(\$x) \{ \newline % Row Count 2 (+ 1) return function (\$y) use (\$x) \{ \newline % Row Count 3 (+ 1) return str\_repeat(\$y, \$x); \newline % Row Count 4 (+ 1) \}; \newline % Row Count 5 (+ 1) \$a = z(2); \newline % Row Count 6 (+ 1) \$b = z(3); \newline % Row Count 7 (+ 1) echo \$a(3) . \$b(2); \newline % Row Count 8 (+ 1) A. 22333 \newline % Row Count 9 (+ 1) B. 33222 \newline % Row Count 10 (+ 1) C. 33322 \newline % Row Count 11 (+ 1) D. 222333% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class A\{ \newline % Row Count 2 (+ 1) public \$a = 1; \newline % Row Count 3 (+ 1) public \seqsplit{function\_\_construct(\$a)} \{\$this-\textgreater{}a= \$a;\} \newline % Row Count 4 (+ 1) public function mul()\{ \newline % Row Count 5 (+ 1) return function (\$x)\{ \newline % Row Count 6 (+ 1) return \$this-\textgreater{}\$a*\$x; \newline % Row Count 7 (+ 1) \}; \newline % Row Count 8 (+ 1) \$a= newA(2); \newline % Row Count 9 (+ 1) \$a-\textgreater{}mul = function(\$x)\{ \newline % Row Count 10 (+ 1) return \$x*\$x; \newline % Row Count 11 (+ 1) \}; \newline % Row Count 12 (+ 1) \$m = \$a-\textgreater{}mul(); \newline % Row Count 13 (+ 1) echo \$m(3); \newline % Row Count 14 (+ 1) A.9 \newline % Row Count 15 (+ 1) B. 6 \newline % Row Count 16 (+ 1) C. 0 \newline % Row Count 17 (+ 1) D. 3% Row Count 18 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer: B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{How many times will the function counter() be executed in the following code? \newline % Row Count 2 (+ 2) function counter(\$start, \&\$stop) \newline % Row Count 3 (+ 1) if (\$stop \textgreater{} \$start) \newline % Row Count 4 (+ 1) return; \newline % Row Count 5 (+ 1) counter(\$start-{}-, ++\$stop); \newline % Row Count 6 (+ 1) \$start = 5; \newline % Row Count 7 (+ 1) \$stop = 2; \newline % Row Count 8 (+ 1) counter(\$start, \$stop); \newline % Row Count 9 (+ 1) A. 3 \newline % Row Count 10 (+ 1) B. 4 \newline % Row Count 11 (+ 1) C. 5 \newline % Row Count 12 (+ 1) D. 6% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) try \{ \newline % Row Count 2 (+ 1) class MyException extends Exception \{\}; \newline % Row Count 3 (+ 1) try \{ \newline % Row Count 4 (+ 1) throw new MyException; \newline % Row Count 5 (+ 1) catch (Exception \$e) \{ \newline % Row Count 6 (+ 1) echo "1:"; \newline % Row Count 7 (+ 1) throw \$e; \newline % Row Count 8 (+ 1) catch (MyException \$e) \{ \newline % Row Count 9 (+ 1) echo "2:"; \newline % Row Count 10 (+ 1) throw \$e; \newline % Row Count 11 (+ 1) catch (Exception \$e) \{ \newline % Row Count 12 (+ 1) echo get\_class(\$e); \newline % Row Count 13 (+ 1) A. A parser error, try cannot be followed by multiple catch \newline % Row Count 15 (+ 2) B. 1: \newline % Row Count 16 (+ 1) C. 2: \newline % Row Count 17 (+ 1) D. 1:Exception \newline % Row Count 18 (+ 1) E. 1:MyException \newline % Row Count 19 (+ 1) F. 2:MyException \newline % Row Count 20 (+ 1) G. MyException% Row Count 21 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : E} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class Bar \{ \newline % Row Count 2 (+ 1) private \$a = 'b'; \newline % Row Count 3 (+ 1) public \$c = 'd'; \newline % Row Count 4 (+ 1) \$x = (array) new Bar(); \newline % Row Count 5 (+ 1) echo array\_key\_exists('a', \$x) ? 'true' : 'false'; \newline % Row Count 7 (+ 2) echo '-'; \newline % Row Count 8 (+ 1) echo array\_key\_exists('c', \$x) ? 'true' : 'false'; \newline % Row Count 10 (+ 2) A. false-false \newline % Row Count 11 (+ 1) B. false-true \newline % Row Count 12 (+ 1) C. true-false \newline % Row Count 13 (+ 1) D. true-true% Row Count 14 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) \$text = 'This is text'; \newline % Row Count 2 (+ 1) \$text1 = \textless{}\textless{}\textless{}'TEXT' \newline % Row Count 3 (+ 1) \$text \newline % Row Count 4 (+ 1) TEXT; \newline % Row Count 5 (+ 1) \$text2 = \textless{}\textless{}\textless{}TEXT \newline % Row Count 6 (+ 1) \$text1 \newline % Row Count 7 (+ 1) TEXT; \newline % Row Count 8 (+ 1) echo "\$text2"; \newline % Row Count 9 (+ 1) A. This is text \newline % Row Count 10 (+ 1) B. \$text \newline % Row Count 11 (+ 1) C. \$text1 \newline % Row Count 12 (+ 1) D. \$text2% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) function ratio (\$x1 = 10, \$x2) \newline % Row Count 2 (+ 1) if (isset (\$x2)) \{ \newline % Row Count 3 (+ 1) return \$x2 / \$x1; \newline % Row Count 4 (+ 1) echo ratio (0); \newline % Row Count 5 (+ 1) A. 0 \newline % Row Count 6 (+ 1) B. An integer overflow error \newline % Row Count 7 (+ 1) C. A warning, because \$x1 is not set \newline % Row Count 8 (+ 1) D. A warning, because \$x2 is not set \newline % Row Count 9 (+ 1) E. A floating-point overflow error \newline % Row Count 10 (+ 1) F. Nothing% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) function increment (\$val) \newline % Row Count 2 (+ 1) \$\_GET{[}'m'{]} = (int) \$\_GET{[}'m'{]} + 1; \newline % Row Count 3 (+ 1) \$\_GET{[}'m'{]} = 1; \newline % Row Count 4 (+ 1) echo \$\_GET{[}'m'{]};% Row Count 5 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : 1} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What will be the result of the following operation? \newline % Row Count 2 (+ 2) \$a = array\_merge({[}1,2,3{]} + {[}4=\textgreater{}1,5,6{]}); \newline % Row Count 3 (+ 1) echo \$a{[}2{]}; \newline % Row Count 4 (+ 1) A. 4 \newline % Row Count 5 (+ 1) B. 3 \newline % Row Count 6 (+ 1) C. 2 \newline % Row Count 7 (+ 1) D. false \newline % Row Count 8 (+ 1) E. Parse error% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class Test \{ \newline % Row Count 2 (+ 1) public \$var=1; \newline % Row Count 3 (+ 1) \} \newline % Row Count 4 (+ 1) function addMe (Test \$t)\{ \newline % Row Count 5 (+ 1) \$t-\textgreater{}var++; \newline % Row Count 6 (+ 1) \} \newline % Row Count 7 (+ 1) \$t = new Test(); \newline % Row Count 8 (+ 1) addMe(\$t); \newline % Row Count 9 (+ 1) echo \$t-\textgreater{}var; \newline % Row Count 10 (+ 1) A. 1 \newline % Row Count 11 (+ 1) B. 2 \newline % Row Count 12 (+ 1) C. null% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) function fibonacci (\&\$x1 = 0, \&\$x2 = 1) \newline % Row Count 2 (+ 1) \$result = \$x1 + \$x2; \newline % Row Count 3 (+ 1) \$x1 = \$x2; \newline % Row Count 4 (+ 1) \$x2 = \$result; \newline % Row Count 5 (+ 1) return \$result; \newline % Row Count 6 (+ 1) for (\$i = 0; \$i \textless{} 10; \$i++) \{ \newline % Row Count 7 (+ 1) echo fibonacci() . ','; \newline % Row Count 8 (+ 1) A. An error \newline % Row Count 9 (+ 1) B. 1,1,1,1,1,1,1,1,1,1, \newline % Row Count 10 (+ 1) C. 1,1,2,3,5,8,13,21,34,55, \newline % Row Count 11 (+ 1) D. Nothing% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) function append(\$str) \newline % Row Count 2 (+ 1) \$str = \$str.'append'; \newline % Row Count 3 (+ 1) function prepend(\&\$str) \newline % Row Count 4 (+ 1) \$str = 'prepend'.\$str; \newline % Row Count 5 (+ 1) \$string = 'zce'; \newline % Row Count 6 (+ 1) \seqsplit{append(prepend(\$string));} \newline % Row Count 7 (+ 1) echo \$string; \newline % Row Count 8 (+ 1) A. zceappend \newline % Row Count 9 (+ 1) B. prependzceappend \newline % Row Count 10 (+ 1) C. prependzce \newline % Row Count 11 (+ 1) D. zce% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Consider the following code. What change must be made to the class for the code to work \newline % Row Count 2 (+ 2) as written? \newline % Row Count 3 (+ 1) class Magic \{ \newline % Row Count 4 (+ 1) protected \$v = array("a" =\textgreater{} 1, "b" =\textgreater{} 2, "c" =\textgreater{} 3); \newline % Row Count 6 (+ 2) public function \_\_get(\$v) \{ \newline % Row Count 7 (+ 1) return \$this-\textgreater{}v{[}\$v{]}; \newline % Row Count 8 (+ 1) \$m = new Magic(); \newline % Row Count 9 (+ 1) \$m-\textgreater{}d{[}{]} = 4; \newline % Row Count 10 (+ 1) echo \$m-\textgreater{}d{[}0{]}; \newline % Row Count 11 (+ 1) A. Nothing, this code works just fine. \newline % Row Count 12 (+ 1) B. Add \_\_set method doing \$this-\textgreater{}v{[}\$var{]} = \$val \newline % Row Count 13 (+ 1) C. Rewrite \_\_get as: public function \_\_get(\&\$v) \newline % Row Count 14 (+ 1) D. Rewrite \_\_get as: public function \&\_\_get(\$v) \newline % Row Count 15 (+ 1) E. Make \_\_get method static% Row Count 16 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{In the following code, which classes can be instantiated? \newline % Row Count 2 (+ 2) abstract class Graphics \{ \newline % Row Count 3 (+ 1) abstract function draw(\$im, \$col); \newline % Row Count 4 (+ 1) abstract class Point1 extends Graphics \{ \newline % Row Count 5 (+ 1) public \$x, \$y; \newline % Row Count 6 (+ 1) function \_\_construct(\$x, \$y) \{ \newline % Row Count 7 (+ 1) \$this-\textgreater{}x = \$x; \newline % Row Count 8 (+ 1) \$this-\textgreater{}y = \$y; \newline % Row Count 9 (+ 1) function draw(\$im, \$col) \{ \newline % Row Count 10 (+ 1) ImageSetPixel(\$im, \$this-\textgreater{}x, \$this-\textgreater{}y, \$col); \newline % Row Count 11 (+ 1) class Point2 extends Point1 \{ \} \newline % Row Count 12 (+ 1) abstract class Point3 extends Point2 \{ \} \newline % Row Count 13 (+ 1) A. Graphics \newline % Row Count 14 (+ 1) B. Point1 \newline % Row Count 15 (+ 1) C. Point2 \newline % Row Count 16 (+ 1) D. Point3 \newline % Row Count 17 (+ 1) E. None, the code is invalid% Row Count 18 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{How can the id attribute of the 2nd baz element from the XML string below be retrieved \newline % Row Count 2 (+ 2) from the SimpleXML object \newline % Row Count 3 (+ 1) found inside \$xml? \newline % Row Count 4 (+ 1) \textless{}?xml version='1.0'?\textgreater{} \newline % Row Count 5 (+ 1) \textless{}foo\textgreater{} \newline % Row Count 6 (+ 1) \textless{}bar\textgreater{} \newline % Row Count 7 (+ 1) \textless{}baz id="1"\textgreater{}One\textless{}/baz\textgreater{} \newline % Row Count 8 (+ 1) \textless{}baz id="2"\textgreater{}Two\textless{}/baz\textgreater{} \newline % Row Count 9 (+ 1) \textless{}/bar\textgreater{} \newline % Row Count 10 (+ 1) \textless{}/foo\textgreater{} \newline % Row Count 11 (+ 1) A. \$xml-\textgreater{}getElementById('2'); \newline % Row Count 12 (+ 1) B. \$xml-\textgreater{}foo-\textgreater{}bar-\textgreater{}baz{[}2{]}{[}'id'{]} \newline % Row Count 13 (+ 1) C. \$xml-\textgreater{}foo-\textgreater{}baz{[}2{]}{[}'id'{]} \newline % Row Count 14 (+ 1) D. \$xml-\textgreater{}foo-\textgreater{}bar-\textgreater{}baz{[}1{]}{[}'id'{]} \newline % Row Count 15 (+ 1) E. \$xml-\textgreater{}bar-\textgreater{}baz{[}1{]}{[}'id'{]}% Row Count 16 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : E} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What will be the output value of the following code? \newline % Row Count 2 (+ 2) \$array = array(1,2,3); \newline % Row Count 3 (+ 1) while (list(,\$v) = each(\$array)); \newline % Row Count 4 (+ 1) \seqsplit{var\_dump(current(\$array));} \newline % Row Count 5 (+ 1) A. bool(false) \newline % Row Count 6 (+ 1) B. int(3) \newline % Row Count 7 (+ 1) C. int(1) \newline % Row Count 8 (+ 1) D. NULL \newline % Row Count 9 (+ 1) E. Array% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the return value of the following code? \newline % Row Count 1 (+ 1) strpos("me myself and I", "m", 2) \newline % Row Count 2 (+ 1) A. 2 \newline % Row Count 3 (+ 1) B. 3 \newline % Row Count 4 (+ 1) C. 4 \newline % Row Count 5 (+ 1) D. 0 \newline % Row Count 6 (+ 1) E. 1% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) namespace MyNamespace; \newline % Row Count 2 (+ 1) class test\{ \newline % Row Count 3 (+ 1) \} \newline % Row Count 4 (+ 1) echo Test :: class; \newline % Row Count 5 (+ 1) A. MyNamespace\textbackslash{}Test \newline % Row Count 6 (+ 1) B. empty string \newline % Row Count 7 (+ 1) C. parse error \newline % Row Count 8 (+ 1) D. Test% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the result of the following code? \newline % Row Count 1 (+ 1) define('PI', 3.14); \newline % Row Count 2 (+ 1) class T \newline % Row Count 3 (+ 1) const PI = PI; \newline % Row Count 4 (+ 1) class Math \newline % Row Count 5 (+ 1) const PI = T::PI; \newline % Row Count 6 (+ 1) echo Math::PI; \newline % Row Count 7 (+ 1) A. Parse error \newline % Row Count 8 (+ 1) B. 3.14 \newline % Row Count 9 (+ 1) C. PI \newline % Row Count 10 (+ 1) D. T::PI% Row Count 11 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) function increment (\&\$val) \newline % Row Count 2 (+ 1) return \$val + 1; \newline % Row Count 3 (+ 1) \$a = 1; \newline % Row Count 4 (+ 1) echo increment (\$a); \newline % Row Count 5 (+ 1) echo increment (\$a);% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : 22} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) \$a = {[}'1'=\textgreater{}'Apple', '3'=\textgreater{}'cactus', '5'=\textgreater{}'Elderflower'{]} + {[}'Bannana', 'fig' , 'dragon frouit'{]}; \newline % Row Count 3 (+ 2) echo count(\$a);% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : 1} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class Test \{ \newline % Row Count 2 (+ 1) public function \_\_call(\$name, \$args) \newline % Row Count 3 (+ 1) \seqsplit{call\_user\_func\_array(array('static'}, "test\$name"), \$args); \newline % Row Count 5 (+ 2) public function testS(\$l) \{ \newline % Row Count 6 (+ 1) echo "\$l,"; \newline % Row Count 7 (+ 1) class Test2 extends Test \{ \newline % Row Count 8 (+ 1) public function testS(\$l) \{ \newline % Row Count 9 (+ 1) echo "\$l,\$l,"; \newline % Row Count 10 (+ 1) \$test = new Test2(); \newline % Row Count 11 (+ 1) \$test-\textgreater{}S('A'); \newline % Row Count 12 (+ 1) A. A, \newline % Row Count 13 (+ 1) B. A,A, \newline % Row Count 14 (+ 1) C. A,A,A, \newline % Row Count 15 (+ 1) D. PHP Warning: \seqsplit{call\_user\_func\_array()} expects parameter 1 to be a valid callback% Row Count 17 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{what is the output of the following code? \newline % Row Count 1 (+ 1) \$first = "second"; \newline % Row Count 2 (+ 1) \$second = "first"; \newline % Row Count 3 (+ 1) echo \$\$\$first; \newline % Row Count 4 (+ 1) A. "first" \newline % Row Count 5 (+ 1) B. "second" \newline % Row Count 6 (+ 1) C. an empty sting \newline % Row Count 7 (+ 1) D. an error% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{answer: B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) \$a= 'a'; \$b = 'b'; \newline % Row Count 2 (+ 1) echo isset(\$c) ? \$a.\$b.\$c : (\$c = 'c') . 'd'; \newline % Row Count 3 (+ 1) A. abc \newline % Row Count 4 (+ 1) B. cd \newline % Row Count 5 (+ 1) C. 0c% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) var\_dump(boolval(-1)); \newline % Row Count 2 (+ 1) A. bool(true) \newline % Row Count 3 (+ 1) B. bool(false)% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{An HTML form contains this form element: \newline % Row Count 1 (+ 1) \textless{}input type="file" name="myFile" /\textgreater{} \newline % Row Count 2 (+ 1) When this form is submitted, the following PHP code gets executed: \newline % Row Count 4 (+ 2) move\_uploaded\_file( \newline % Row Count 5 (+ 1) \$\_FILES{[}'myFile'{]}{[}'tmp\_name'{]}, \newline % Row Count 6 (+ 1) 'uploads/' . \$\_FILES{[}'myFile'{]}{[}'name'{]} \newline % Row Count 7 (+ 1) ); \newline % Row Count 8 (+ 1) Which of the following actions must be taken before this code may go into production? \newline % Row Count 10 (+ 2) (Choose 2) \newline % Row Count 11 (+ 1) A. Check with is\_uploaded\_file() whether the uploaded file \$\_FILES{[}'myFile'{]}{[}'tmp\_name'{]} is valid \newline % Row Count 13 (+ 2) B. Sanitize the file name in \$\_FILES{[}'myFile'{]}{[}'name'{]} because this value is not consistent among web browsers \newline % Row Count 16 (+ 3) C. Check the charset encoding of the HTTP request to see whether it matches the encoding of the uploaded file \newline % Row Count 19 (+ 3) D. Sanitize the file name in \$\_FILES{[}'myFile'{]}{[}'name'{]} because this value could be forged \newline % Row Count 21 (+ 2) E. Use \$HTTP\_POST\_FILES instead of \$\_FILES to maintain upwards compatibility% Row Count 23 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B,D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What will be the result of the following operation? \newline % Row Count 2 (+ 2) array\_combine(array("A","B","C"), array(1,2,3)); \newline % Row Count 3 (+ 1) A. array("A","B","C",1,2,3) \newline % Row Count 4 (+ 1) B. array(1,2,3,"A","B",C") \newline % Row Count 5 (+ 1) C. array("A"=\textgreater{}1,"B"=\textgreater{}2,"C"=\textgreater{}3) \newline % Row Count 6 (+ 1) D. array(1=\textgreater{}"A",2=\textgreater{}"B",3=\textgreater{}"C") \newline % Row Count 7 (+ 1) E. array(1,2,3)% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Given a DateTime object that is set to the first second of the year 2014, which of the following samples will correctly return a date in the format '2014-01-01 00:00:01'? \newline % Row Count 4 (+ 4) A. \$datetime-\textgreater{}format('\%Y-\%m-\%d \%h:\%i:\%s') \newline % Row Count 5 (+ 1) B. \$datetime-\textgreater{}format('\%Y-\%m-\%d \%h:\%i:\%s', array('year', 'month', 'day', 'hour', 'minute', 'second')) \newline % Row Count 8 (+ 3) C. \$datetime-\textgreater{}format('Y-m-d H:i:s') \newline % Row Count 9 (+ 1) D. \$date = date('Y-m-d H:i:s', \$datetime);% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) echo "22" + "0.2", 23 . 1; \newline % Row Count 2 (+ 1) A. 220.2231 \newline % Row Count 3 (+ 1) B. 22.2231 \newline % Row Count 4 (+ 1) C. 22.2,231 \newline % Row Count 5 (+ 1) D. 56.2% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\$world = 'world'; \newline echo \textless{}\textless{}\textless{}'TEXT' \newline hello \$world \newline TEXT;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{What is the output of this code? \newline \newline A. hello world \newline B. hello \$world \newline C. PHP Parser error \newline \newline answer: C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What will be the output of the following code? \newline % Row Count 1 (+ 1) \$a = array(0, 1, 2 =\textgreater{} array(3, 4)); \newline % Row Count 2 (+ 1) \$a{[}3{]} = array(4, 5); \newline % Row Count 3 (+ 1) echo count(\$a, 1); \newline % Row Count 4 (+ 1) A. 4 \newline % Row Count 5 (+ 1) B. 5 \newline % Row Count 6 (+ 1) C. 8 \newline % Row Count 7 (+ 1) D. None of the above% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) for (\$i = 0; \$i \textless{} 1.02; \$i += 0.17) \{ \newline % Row Count 2 (+ 1) \$a{[}\$i{]} = \$i; \newline % Row Count 3 (+ 1) echo count(\$a); \newline % Row Count 4 (+ 1) A. 0 \newline % Row Count 5 (+ 1) B. 1 \newline % Row Count 6 (+ 1) C. 2 \newline % Row Count 7 (+ 1) D. 6 \newline % Row Count 8 (+ 1) E. 7% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Given the following code, how can we use both traits A and B in the same class? (select all that apply) \newline % Row Count 3 (+ 3) trait A \{ \newline % Row Count 4 (+ 1) public function hello() \{ \newline % Row Count 5 (+ 1) return "hello"; \newline % Row Count 6 (+ 1) public function world() \{ \newline % Row Count 7 (+ 1) return "world"; \newline % Row Count 8 (+ 1) trait B \{ \newline % Row Count 9 (+ 1) public function hello() \{ \newline % Row Count 10 (+ 1) return "Hello"; \newline % Row Count 11 (+ 1) public function person(\$name) \{ \newline % Row Count 12 (+ 1) return ":\$name"; \newline % Row Count 13 (+ 1) A. Rename the A::hello() method to a different name using A::hello as helloA; \newline % Row Count 15 (+ 2) B. Use B::hello() instead of A 's version using B::hello insteadof A \newline % Row Count 17 (+ 2) C. Use B::hello() instead of A 's version using use B::hello \newline % Row Count 19 (+ 2) D. Rename the A::hello() method to a different name using A::hello renameto helloA; \newline % Row Count 21 (+ 2) E. None of the above (both can be used directly)% Row Count 22 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{In the following code, which line should be changed so it outputs the number 2: \newline % Row Count 2 (+ 2) class A \{ \newline % Row Count 3 (+ 1) protected \$x = array(); /{\emph{ A }}/ \newline % Row Count 4 (+ 1) public function getX() \{ /{\emph{ B }}/ \newline % Row Count 5 (+ 1) return \$this-\textgreater{}x; /{\emph{ C }}/ \newline % Row Count 6 (+ 1) \$a = new A(); /{\emph{ D }}/ \newline % Row Count 7 (+ 1) array\_push(\$a-\textgreater{}getX(), "one"); \newline % Row Count 8 (+ 1) array\_push(\$a-\textgreater{}getX(), "two"); \newline % Row Count 9 (+ 1) echo count(\$a-\textgreater{}getX()); \newline % Row Count 10 (+ 1) A. No changes needed, the code would output 2 as is \newline % Row Count 12 (+ 2) B. Line A, to: protected \&\$x = array(); \newline % Row Count 13 (+ 1) C. Line B, to: public function \&getX() \{ \newline % Row Count 14 (+ 1) D. Line C, to: return \&\$this-\textgreater{}x; \newline % Row Count 15 (+ 1) E. Line D, to: \$a =\& new A();% Row Count 16 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) class Foo Implements ArrayAccess \{ \newline % Row Count 2 (+ 1) function offsetExists(\$k) \{ return true;\} \newline % Row Count 3 (+ 1) function offsetGet(\$k) \{return 'a';\} \newline % Row Count 4 (+ 1) function offsetSet(\$k, \$v) \{\} \newline % Row Count 5 (+ 1) function offsetUnset(\$k) \{\} \newline % Row Count 6 (+ 1) \$x = new Foo(); \newline % Row Count 7 (+ 1) echo array\_key\_exists('foo', \$x)?'true':'false'; \newline % Row Count 8 (+ 1) A. true \newline % Row Count 9 (+ 1) B. false% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) function increment (\$val) \newline % Row Count 2 (+ 1) ++\$val; \newline % Row Count 3 (+ 1) \$val = 1; \newline % Row Count 4 (+ 1) increment (\$val); \newline % Row Count 5 (+ 1) echo \$val;% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : 1} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) function increment (\$val) \newline % Row Count 2 (+ 1) \$val = \$val + 1; \newline % Row Count 3 (+ 1) \$val = 1; \newline % Row Count 4 (+ 1) increment (\$val); \newline % Row Count 5 (+ 1) echo \$val;% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : 1} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) var\_dump(boolval(new StdClass())); \newline % Row Count 2 (+ 1) A. bool(true) \newline % Row Count 3 (+ 1) B. bool(false)% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Consider the following code. Which keyword should be used in the line marked with \newline % Row Count 2 (+ 2) "KEYWORD" instead of "self" to make this code work as intended? \newline % Row Count 4 (+ 2) abstract class Base \{ \newline % Row Count 5 (+ 1) protected function \_\_construct() \{ \newline % Row Count 6 (+ 1) public static function create() \{ \newline % Row Count 7 (+ 1) return new self(); // KEYWORD \newline % Row Count 8 (+ 1) abstract function action(); \newline % Row Count 9 (+ 1) class Item extends Base \{ \newline % Row Count 10 (+ 1) public function action() \{ echo \_\_CLASS\_\_; \} \newline % Row Count 11 (+ 1) \$item = Item::create(); \newline % Row Count 12 (+ 1) \$item-\textgreater{}action(); // outputs "Item"% Row Count 13 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : static} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) \$string = `Good luck!`; \newline % Row Count 2 (+ 1) \$start = 10; \newline % Row Count 3 (+ 1) var\_dump (substr(\$string, \$start)); \newline % Row Count 4 (+ 1) A. string(0) "" \newline % Row Count 5 (+ 1) B. bool(false) \newline % Row Count 6 (+ 1) C. string(1) "!" \newline % Row Count 7 (+ 1) D. string(2) "k!"% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following code snippets is correct? (Choose 2) \newline % Row Count 2 (+ 2) A. interface Drawable \{ abstract function draw(); \} \newline % Row Count 4 (+ 2) B. interface Point \{ function getX(); function getY(); \} \newline % Row Count 6 (+ 2) C. interface Line extends Point \{ function getX2(); function getY2(); \} \newline % Row Count 8 (+ 2) D. interface Circle implements Point \{ function getRadius(); \}% Row Count 10 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B, C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) `class test \{ \newline % Row Count 2 (+ 1) public \$value = 0; \newline % Row Count 3 (+ 1) function test() \{ \newline % Row Count 4 (+ 1) \$this-\textgreater{}value = 1; \newline % Row Count 5 (+ 1) function \_\_construct() \{ \newline % Row Count 6 (+ 1) \$this-\textgreater{}value = 2; \newline % Row Count 7 (+ 1) \$object = new test(); \newline % Row Count 8 (+ 1) echo \$object-\textgreater{}value;` \newline % Row Count 9 (+ 1) A. 2 \newline % Row Count 10 (+ 1) B. 1 \newline % Row Count 11 (+ 1) C. 0 \newline % Row Count 12 (+ 1) D. 3 \newline % Row Count 13 (+ 1) E. No Output, PHP will generate an error message.% Row Count 14 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : A} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{What is the output of the following code? \newline % Row Count 1 (+ 1) echo 0x33, ' monkeys sit on ', 011, ' trees.'; \newline % Row Count 2 (+ 1) A. 33 monkeys sit on 11 trees. \newline % Row Count 3 (+ 1) B. 51 monkeys sit on 9 trees. \newline % Row Count 4 (+ 1) C. monkeys sit on trees. \newline % Row Count 5 (+ 1) D. 0x33 monkeys sit on 011 trees.% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : B} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Which of the following expressions will evaluate to a random value from an array below? \newline % Row Count 2 (+ 2) \$array = array("Sue","Mary","John","Anna"); \newline % Row Count 3 (+ 1) A. array\_rand(\$array); \newline % Row Count 4 (+ 1) B. array\_rand(\$array, 1); \newline % Row Count 5 (+ 1) C. shuffle(\$array); \newline % Row Count 6 (+ 1) D. \$array{[}array\_rand(\$array){]}; \newline % Row Count 7 (+ 1) E. array\_values(\$array, ARRAY\_RANDOM);% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : D} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Output Test}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{After performing the following operations: \newline % Row Count 1 (+ 1) \$a = array('a', 'b', 'c'); \newline % Row Count 2 (+ 1) \$a = \seqsplit{array\_keys(array\_flip(\$a));} \newline % Row Count 3 (+ 1) What will be the value of \$a? \newline % Row Count 4 (+ 1) A. array('c', 'b', 'a') \newline % Row Count 5 (+ 1) B. array(2, 1, 0) \newline % Row Count 6 (+ 1) C. array('a', 'b', 'c') \newline % Row Count 7 (+ 1) D. None of the above% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Answer : C} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}