sd2 Flashcards

1
Q

In PHP, variable names must begin with a &
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

This is a valid PHP statement: echo ‘This is a line of text’;
A. True
B. False

A

A. True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

To make a valid statement that displays a double quote we would do something like this: it with a “/” This is a valid PHP statement:

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The HTML protocol allows clients and servers to communicate.
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
Which port is commonly used by servers for web communications?
 A. 80
 B. 25
 C. 8080
 D. None of the above
A

A. 80

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
The term for ipaddress:port is:
 A. localhost
 B. default address
 C. socket
 D. connection
A

C. Socket

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

To begin a block of PHP code we use the tag: “

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

This is a valid single line PHP comment: // this is a comment
A. True
B. False

A

A. True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
Which command defines the accesses a user will have:
 A. ACCESS
 B. SET ACCESS
 C. GRANT
 D. USER
A

C. Grant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The main reason we put connect_db in an include file is to avoid duplicating the code in multiple files.
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The MYSQL_CONNECT function allows PHP to connect to a database.
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The elements of an array are defined by brackets, for example: $thisarray[45]
A. True
B. False

A

A. True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The first two elements of an array name $thisarray would be $thisarray[1] and $thisarray[2]
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

For the function - mysqli_query ( $dbc , $q) - $dbc is set to the database name.
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The PING command displays all the hops from one host to another host.
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
Which command will exit a PHP program?
 A. END
 B. DIE
 C. QUIT
 D. None of the above
A

B. Die

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q
To reference a file in a parent folder, we preface the filename with \_\_\_\_\_\_\_\_\_.
 A. C:\
 B. C:\SD2
 C. C:\SD2\
 D. ..\
A

D. ..\

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q
What is the result of 10%3?
 A. 0
 B. 1
 C. 3
 D. None of the above
A

B. 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
What PHP command creates a constant?
 A. CONSTANT
 B. DEFINE
 C. IDENTIFY
 D. None of the above
A

B. Define

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The first character after the & must be a number or a _
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

To concatenate strings separate with a period place in double quotes
A. True
B. False

A

A. True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Echo with double quotes does not do variable substitution
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Even if you set an element a second time, it will not overwrite that element.
A. True
B. False

A

B. False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The following statement will ALWAYS be true: if ($x =5)
A. True
B. False

A

A. True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
The following statement will set an array: $months = array(“1” => “Jan”); A. True B. False
A. True
26
``` Which function is used to retrieve one row of returned data. A. mysqli_get_row B. mysqli_fetch_array C. mysqli_query D. none of the above ```
B. myseli_fetch_array
27
In our code, we first set $dbc to the string “site_db” so we can use it with the mysqli_query function. A. True B. False
B. False
28
Given: “
B. This is not a good practice
29
We don’t always end a block of PHP code with “?>”. A. True B. False
A. True
30
We place our database connection code in a separate file to reduce duplicating code. A. True B. False
B. False
31
The variable named “bodytemp” is a “good’ (best practices) name since it is explanatory. A. True B. False
B. False
32
Variables in our main code: A. can be referenced throughout the entire file, including inside functions B. can not be referenced inside functions C. can be referenced throughout the entire file if defined as global D. none of the above
C. can be referenced throughout the entire file if defined as global
33
Which is true about program complexity? A. the higher the coupling, the more complex the system. B. a static relationship is one that is stable and does not depend on program execution. C. dynamic relationships, which change over time, are more complex than static relationships. D. all of the above
D. All of the above
34
``` Which of these is NOT a type of complexity? A. security complexity B. reading complexity C. structural complexity D. data complexity ```
A. security complexity
35
Which of these is a way to lessen program complexity? A. use absolute numbers instead of naming constants B. re-use existing software C. use deeply nested conditional statements D. none of the above
B. re-use existing software
36
``` Which of these is NOT one of the quality attributes of reliable programming? A. user experience B. reliability C. user interface D. maintainability ```
C. User interface
37
``` Which of these is NOT used to reduce program complexity by redefining and simplifying the problem? A. readable program names B. readable function names C. readable variable names D. none of the above ```
D. none of the above
38
program complexity...? A. is related to number of relationships between program elements B. is related to the nature of relationships between program elements C. both A and B D. none of the above
C. both A and B
39
Rules for name checking include that...? A. the length of a name should be between 1 and 10 characters. B. names must start with a letter. C. non-alphabetic separator characters are allowed D. none of the above
B. names must start with a letter.
40
Refactoring is changing a program to reduce its complexity without changing the eternal behavior of the program A. True B. False
A. True
40
Refactoring is changing a program to reduce its complexity without changing the eternal behavior of the program A. True B. False
A. True
41
The underlying cause of many program errors is complexity A. True B. False
A. True
42
Which of these is NOT a best practice? A. use a text-editor that color-codes code B. copy and paste code to make things easier C. format your code in easy to read columns D. if you don’t understand how something works, google it
B. copy and paste code to make things easier
43
Which of these statements is true about PHP functions: A. They never return a value B. They can return only 1 value C. They can return multiple values D. They can return the same number of values as the number of arguments
B. they can return only 1 value
44
Using best practices, if we see a PHP reference to “ONE” we can assume: A. It is set the number 1 B. it is a literal that is set to 1 C. it is a defined constant
C. it is a defined constant
45
``` Which PHP function will change “marist” to “MARIST”? A. upper() B. convert() C. upcase() D. none of the above ```
D. none of the above
46
``` Which PHP function returns the number of characters in a string? A. length() B. strlen() C. numofchars() D. none of the above ```
B. Strlen()
47
Which of these is an example of input validation? A. is it in the correct format? B. is it safe from hackers? C. is it free from overflows and other critical errors? D. all of the above
D. All of the above
48
``` which of these is NOT a code smell? A. duplicated code B. Small classes C. meaningless names D. unused code ```
B. Small class
49
Decision complexity is the type that reflects the complexity of the decisions in your program A. True B. False
A. True
50
Which of these statements about Arrays is incorrect? A. you cannot create an array of numbers B. if you use the array() command a second time it will overwrite the array variable. C. if an element is not defined it is 'unset' and can be checked by the ‘isset’ function D. none of the above (tey are all correct)
A. you cannot create an array of numbers
51
Which of these is correct about operators? A. ++$x performs a “post-increment” operation B. || performs a “or” operation C. $x++ performs a “pre-increment” operation D. ! performs “and/or” operation
B. || performs a "or" operation
52
Which of these is correct about operators? A. ++$x performs a “post-increment” operation B. || performs a “or” operation C. $x++ performs a “pre-increment” operation D. ! performs “and/or” operation
B. || performs a "or" operation
53
Which of these is correct about Strings and Arrays? A. we can convert an array into a string with EXPLODE B. a string is an array of characters C. we specify what character to use as a connector D. We can convert a string into an array with IMPLODE
B. a string is an array of characters
54
We can sort the data in PHP but we can also sort database records by using the ORDER BY keywords. A. True B. False
A. True
55
You can have double quotes inside single quoted text A. True B. False
A. True
56
Echo with double quotes does not do variable substitution A. True B. False
B. False
57
The CANCEL keyword will automatically execute a loop A. True B. False
B. False
58
Which of these is correct about forms? A. processing data submitted from an HTML form on a web page is perhaps the most fundamental task performed by a PHP script B. the HTML < form > tag’s action attribute is used to nominate the PHP script that will process the form data C. the < form > tag’s method attribute is used to specify how the data is sent to the script – typically by the POST method D. all of the above
D. all of the above
59
``` The HTML tag that causes the browser to reload is: A. RELOAD B. NEW C. FORM D. None of the above ```
C. Form
60
The code “INPUT TYPE=’INPUT’” will always create a button with the word “SUBMIT” in it. A. True B. False
B. False
61
We can use the PHP DATE function to extract and display the current time? A. True B. False
A. True
62
To allow the user to select two different radio buttons: A. we specify different values B. we specify different types C. we specify different names D. it can’t be done: radio buttons only allow ONE selection
C. we specify different names
63
If the form specifies an input field “temperature” the action handler code can access the value by referencing the variable “$temperature”. #NOK: We reference it via $_POST["temperature"]) A. True B. False
B. False
64
To set the value of a cookie named “course ”to the value “221” we would issue the command: $_COOKIE[‘cookie’]=221; A. True B. False
B. False
65
``` When setting cookies: A. it must be done before the tag B. we can only do it one time in the code C. we cannot overwrite the cookie D. none of the above ```
A. It must be done before the tag
66
A “timing failure” results when interacting system components are not properly synchronized. A. True B. False
A. True
67
``` What do we use to specify inline CSS? A. CSS=’ ‘ B. INLINECSS=’ ‘ C. ICSS=’ ‘ D. none of the above ```
D. none of the above
68
``` What is true about $_POST? A. It is an array B. It is not a constant C. It is a superglobal D. all of the above ```
D. all of the above
69
To create selection boxes, we use:
B. False
70
``` Which of these is NOT a type of testing? A. functional testing B. user testing C. performance and load testing D. none of the above ```
D. None of the above
71
The three U’s of user testing include? A. usability, utility, understandability B. usability, utility, user interface C. usability, user experience, user interface D. none of the above
B. usability, utility, user interface
72
Which of these is NOT correct about test plan guidelines? A. make use of lengthy and detailed paragraphs to explain broad ideas B. avoid redundancy and superfluousness C. have the test plan reviewed a number of times D. update the plan as and when necessary
A. make use of lengthy and detailed paragraphs to explain broad ideas.
73
``` The test process includes...? A. user testing B. feature testing C. security testing D. durability testing ```
B. feature testing
74
Which of these is one of the three potential problems of testing? A. we can only test with our understanding of what the code should do B. tests don't tell us anything about the system C. both a and b D. none of the above
C. both a and b
75
Which of these is NOT correct about feature testing? A. we approach feature testing with the viewpoint of the user B. features may be satisfied by one or more components/units C. feature tests are documented by looking at our original user stories D. usefulness tests test how the units implement the feature
D. usefulness tests test how the units implement the feature.
76
Functional Testing looks to answer the question of how good is the functionality of entire system A. True B. False
A. True
77
During alpha testing you distribute early versions to users for comments A. True B. False
B. False
78
Security testing looks to answer the question of does system maintain integrity A. True B. False
A. True
79
We approach feature testing with the viewpoint of the developer A. True B. False
B. False
80
Ideally test plans should be run by an independent party A. True B. False
A. True
81
Whenever you do a PHP SQL command you need to do error checking and handling A. True B. False
B. False
82
``` Which keyword is used to set the default value for an INPUT on a form? A. value= B. default= C. set= D. none of the above ```
vA. value =
83
PHP can access the name of the “current” file by the value of $_SERVER['SCRIPT_NAME']. A. True B. False
A. True
84
The ACTION of “DeleteUser.php/id=7” will pass the value of 7 to the file DeleteUser.php. A. True B. False
B. False
85
``` Which METHOD is specified the first time a PHP file is loaded in a browser? A. NEW B. NONE C. ONE D. none of the above ```
D. none of the above
86
The mysqli_error function allows us to ‘trap’ an error (detect the error and provide code to handle it) . A. True B. False
B. False
87
If we want to use session variables: A. session_start() must be the first php command B. session variable are browser cookies C. we reference them by $_POST[‘SESSION’] D. we can specify a duration for how long they will be active
A. session_start() must be the first php command
88
The order for authentication are...? A. login, access control mechanism, resources B. access control mechanism, login, resources C. resources, login, access control mechanism D. none of the above
A. login, access control mechanism, resources
89
``` Three-factor authentication includes...? A. Fingerprint & card &PIN B. Fingerprint & PIN & password C. both a and b D. none of the above ```
A. fingerprint & Card & PIN
90
``` Which of these is one of the three types of security attacks? A. Confidentiality B. Integrity C. Availability D. all of the above ```
D. all of the above
91
Which of these is NOT true about cross site scripts? A. it may bypass access controls such as the same-origin policy B. rather than entering SQL code, hackers enter code to run Java in an input field C. it enables attackers to inject client-side scripts into web pages D. XSS was for roughly 84% of all security vulnerabilities documented by Symantec up until 2007
B. rather than entering SQL code, hackers enter code to run Java in an input field
92
``` Two-factor authentication includes? A. ATM card + PIN B. Password + PIN C. both a and b D. none of the above ```
A. ATM card + PIN
93
``` You can authenticate by...? A. What you know B. What you have C. What you do D. All of the above ```
D. All of the above
94
Which of these is correct about security? A. it is advised that you allow database connection script to be directly accessible B. most vulnerabilities come from code defects or things overlooked C. special html and escape characters increase security strength D. not many current hacks are due to known old vulnerabilities
B. most vulnerabilities come from code defects or things overlooked
95
When it comes to authentication factors, something you know is a password or pin A. True B. False
A. True
96
``` Having different passwords to encrypt and decrypt is called: A. Multi-factor encryption B. Asymmetric encryption C. Hashing D. none of the above ```
B. Asymmetric encryption
97
‘Hashing’ is another way of saying ‘encrypting’ A. True B. False
B. False
98
When it comes to authentication factors, something you are is a personal trait A. True B. False
A. True
99
One way to avoid SQL injections is to remove quotes from the variables used in the query string A. True B. False
A. True
100
Programs in Java and JavaScript are vulnerable buffer overflow attacks A. True B. False
B. False
101
When it comes to authentication factors, something you have is a key or token A. True B. False
A. True
102
Each User ID is associated with a secret A. True B. False
A. True
103
DoS stands for denial of security A. True B. False
B. False
104
``` Which of these is part of DevOps? A. release B. support C. development D. all of the above ```
D. all of the above
105
Which of these is NOT correct about code management? A. code management is a set of hardware-supported practices B. the development team will probably create tens of thousands of lines of code and automated tests C. code management tools make it easy to create an executable product from its source code files D. all of the code will be organized into hundreds of files
A. code management is a set of hardware-supported practices
106
Which of these is a DevOps principle? A. measure first, change later B. everyone is responsible for everything C. everything that can be automated should be automated D. all of the above are DevOps principles
D. all of the above are DevOps principles
107
``` Which of these is NOT a feature of code management systems? A. project support B. change history recording C. dependent development D. version and release identification ```
C. dependent development
108
``` Which of these is NOT an aspect of DevOps automation? A. continuous delivery B. continuous iteration C. continuous deployment D. infrastructure as code ```
B. continuous iteration
109
Which of these it NOT correct about the deployment pipeline? A. after initial integration testing, a staged test environment is created B. the staged test environment is a replica of the actual production environment C. to deploy the system, you momentarily stop all new requests for service D. none of the above
D. none of the above
110
``` Which of these is NOT part of continuous delivery and deployment? A. required hardware B. test set C. required software D. tested system ```
A. required hardware
111
Everything that can be, should be automated is a fundamental principle of DevOps A. True B. False
A. True
112
Branching and merging are fundamental ideas that are supported by all code management systems. A. True B. False
A. True
113
A branch is a dependent version that is created when a developer wishes to change a file A. True B. False
B. False