Podcast Beta
Questions and Answers
Which scripting technique focuses primarily on separating data from scripts for varied test runs?
What is a characteristic of structured scripting?
In the context of shared scripting, what does modularity imply?
Which technique utilizes external data files to define both test data and operation sequences?
Signup and view all the answers
What is a potential drawback of linear scripting?
Signup and view all the answers
What is the main focus of data driven scripting?
Signup and view all the answers
Which scripting technique would be best suited for applications requiring frequent modifications to shared behaviors?
Signup and view all the answers
Which of the following describes the purpose of keyword driven testing?
Signup and view all the answers
What is the primary function of a compiler in programming?
Signup and view all the answers
Which of the following is NOT a client-side scripting language?
Signup and view all the answers
What role does client-side scripting play in web development?
Signup and view all the answers
What was the original name of JavaScript before its rebranding?
Signup and view all the answers
How does an interpreter differ from a compiler?
Signup and view all the answers
Which statement accurately reflects the use of JavaScript in web development?
Signup and view all the answers
When a browser requests a webpage, what does the server provide?
Signup and view all the answers
What is the function of CSS in web development?
Signup and view all the answers
What is the primary purpose of creational design patterns?
Signup and view all the answers
What benefit do design patterns provide during software development?
Signup and view all the answers
Which classification of design patterns focuses on the organization of classes and objects?
Signup and view all the answers
What is a distinguishing feature of object-creation patterns?
Signup and view all the answers
Which of the following statements about behavioral patterns is true?
Signup and view all the answers
How do structural class-creation patterns differ from structural object-patterns?
Signup and view all the answers
What is the main reason for reusing design patterns in software design?
Signup and view all the answers
Which design pattern category is least likely to be used for enhancing functionality through object composition?
Signup and view all the answers
What does the $this keyword refer to in PHP?
Signup and view all the answers
How can the value of the $name property be changed outside the class?
Signup and view all the answers
What is the role of the extends keyword in PHP?
Signup and view all the answers
What is required to define a user-defined function in PHP?
Signup and view all the answers
What does passing an argument to a function in PHP resemble?
Signup and view all the answers
Which statement is true regarding the Strawberry class in relation to the Fruit class?
Signup and view all the answers
Which of the following is an essential characteristic of functions in PHP?
Signup and view all the answers
What must occur for a user-defined function to execute?
Signup and view all the answers
What is the purpose of the CREATE DATABASE statement in MySQL?
Signup and view all the answers
Which attribute ensures a column can only hold positive numbers and zero in MySQL?
Signup and view all the answers
What must be true about the SQL query when inserting data into a MySQL database using MySQLi?
Signup and view all the answers
What is the function of the WHERE clause in a MySQL SELECT statement?
Signup and view all the answers
What does the ORDER BY clause do in a MySQL query?
Signup and view all the answers
In which scenario would you use the AUTO INCREMENT attribute in a MySQL table?
Signup and view all the answers
Which of the following is NOT a rule for inserting data into a MySQL table?
Signup and view all the answers
Which column setting would you use to ensure that each row in a table has a unique identifier?
Signup and view all the answers
Study Notes
Design Patterns
- Design patterns categorize into 3 sub-classifications: Creational, Structural, and Behavioral patterns
- Creational patterns focus on object creation based on specific criteria and controlled instantiation.
- Structural patterns are about organizing classes and objects into larger structures, offering new functionality.
- Behavioral patterns identify and implement common communication patterns between objects.
- Design patterns improve code readability for programmers familiar with them
- Design patterns help prevent subtle issues leading to major software issues.
Creational Patterns
- Abstract Factory - provides an interface for creating families of related objects. Ensures consistency within a family.
- Builder - separates the construction of a complex object from its representation
- Factory Method defines an interface for creating objects. Allows subclasses to decide which class to instantiate.
- Prototype: specifies the kinds of objects to create using a prototypical instance. Creates new objects by copying this prototype.
- Singleton: ensures that a class has only one instance and provides a global point of access.
Structural Patterns
- Adapter: converts the interface of a class into another interface clients expect. Enables incompatible classes to work together.
- Bridge: Decouples an abstraction from its implementation. Allows both to vary independently
- Composite: composes objects into tree structures to represent part-whole hierarchies. Lets clients treat individual objects and compositions uniformly.
- Decorator: dynamically adds responsibilities to an object. Provides a flexible alternative to subclassing for extending functionality.
- Facade: provides a simplified interface to a complex subsystem
- Flyweight: shares objects to support large numbers of fine-grained objects efficiently. Uses sharing to support large numbers of fine-grained objects efficiently
- Proxy: provides a surrogate or placeholder for another object to control access to it.
PHP - The '$this' Keyword
- Refers to the current object
- Only available inside methods
- Allows access and manipulation of object properties and methods within the object's context
PHP - Inheritance
- A child class inherits properties and methods from a parent class using the
extends
keyword. - Inherited classes can have their own properties and methods in addition to those inherited.
- Inheritance allows code reuse and creates a hierarchy of classes.
PHP - User-Defined Functions
- Functions are reusable blocks of code that perform specific tasks
- Defined using the
function
keyword followed by the function name and parentheses. - Code within the function is executed only when the function is called.
- Can accept arguments (inputs) and return values (outputs)
Scripting Techniques for Test Automation
- Linear scripting: simple record and playback of user actions. Can be redundant and inflexible.
-
Structured scripting: incorporates control structures like
if-else
,for
andwhile
loops for decision-making and iteration. - Shared scripting: Develops reusable scripts for common functionality across different tests. Enhances modularity and code reuse.
- Data-driven scripting: Separates test data from the script, stored in external data files. Provides flexibility to adjust test data without modifying the script.
- Keyword-driven testing: Uses keywords to represent test actions and stores them in external data files. Requires a library for interpretation.
Client-Side Scripting
- Client-side scripting executes code in the user's browser (client) without needing server interaction.
- This speeds up website performance and reduces server load.
- Examples include JavaScript, HTML, and CSS.
- JavaScript is widely used for dynamic web page elements, user interaction, and validation.
Javascript
- Initially called
LiveScript
. - Released with Netscape 2.0 in 1995.
- Server-side JavaScript frameworks are also available.
MySQLi
- MySQLi is a PHP extension for interacting with MySQL databases.
Opening a Connection to MySQL
- The
mysqli_connect()
function establishes a connection to a MySQL server.
Creating a MySQL Database
- The
CREATE DATABASE
statement creates a new database.
Creating a MySQL Table
- The
CREATE TABLE
statement creates a new table within a database. - It defines columns, their data types, and optional attributes like
NOT NULL
,DEFAULT
,AUTO_INCREMENT
, andPRIMARY KEY
.
Inserting Data Into MySQL
- The
INSERT INTO
statement adds new records to a table. - String values are enclosed in single quotes.
- Numeric values are not quoted.
- The word
NULL
is not quoted.
Selecting Data From MySQL
- The
SELECT
statement retrieves data from a table.
Filtering Data with WHERE Clause
- The
WHERE
clause filters selected data based on specified conditions.
Ordering Data with ORDER BY Clause
- The
ORDER BY
clause sorts the retrieved data in ascending or descending order. - The default order is ascending.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your knowledge on Creational Design Patterns, a part of the larger concept of design patterns in software development. This quiz covers essential patterns like Abstract Factory, Builder, Factory Method, and Prototype, focusing on object creation strategies. Improve your understanding of how these patterns enhance code readability and prevent software issues.