Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

ME - Web Sys

ME[M1-4] - WEB SYSTEM TECHNOLOGIES / IT0049

QuestionAnswer
Which line of code correctly defines a route that maps the URL /about to the about() method of the Pages controller? $routes->get('/about', 'Pages::about');
What is the purpose of a route placeholder such as (:num) in CodeIgniter routing? It captures a numeric segment of the URL and passes it as a parameter
What architectural pattern separates an application into three interconnected components responsible for data, presentation, and control logic? MVC (Model-View-Controller)
A developer argues that since a static PHP array "basically behaves like a small database," there is no real reason to ever migrate a working application to a real database. What is the strongest counterargument? A static array's data disappears when the server restarts and cannot be reliably shared, searched, or updated by multiple users the way a database can
Matching type. Match the term with the correct description.
Route Maps an incoming URL to a specific controller and method
Controller Decides what should happen when a specific URL is requested
Model Manages data and communicates with the database
View Displays information to the user, usually as HTML
What is the term for a segment of a route pattern (such as (:num)) that captures part of the URL and passes it to a controller method as a parameter? Route placeholder (wildcard)
Passing data to a View requires converting the data into a special CodeIgniter-only data type before calling view(). False
Installing CodeIgniter 4 with Composer is the only way to create a new CodeIgniter project. False
A developer runs composer create-project codeigniter4/appstarter myproject in the terminal. What is the most likely purpose of this command? To create a new CodeIgniter 4 project using Composer
Given the route $routes->get('/profile/(:num)', 'Pages::profile/$1');, which URL would correctly trigger this route? /profile/25
A CodeIgniter View file can only contain plain HTML and is not allowed to include any PHP code. False
In the MVC pattern, which component is responsible for directly interacting with the database to retrieve or store data? Model
Route definitions in CodeIgniter are typically written in the file app/Config/Routes.php. True
In the MVC pattern, the Controller is responsible for deciding which View is displayed in response to a request. True
A controller currently has public function about() { return view('about'); }. A developer wants the About page to also display the current year automatically. What is the correct way to do this? Pass the year from the controller to the view using an array, e.g. return view('about', ['year' => date('Y')]);
A routes file contains $routes->get('/tasks', 'Tasks::index'); and, further down, another line $routes->get('/tasks', 'Tasks::list');. When a user visits /tasks, which method actually runs? Tasks::index(), because CodeIgniter uses the first matching route it finds
What does MVC stand for in the context of web application architecture? Model-View-Controller
What is the name of the function used inside a CodeIgniter controller to load a View file and optionally pass data to it? view()
A student visits a page and gets a "404 Page Not Found" error, even though the controller method exists and runs without issue when tested directly. What is the most likely cause? No route was defined for that URL and no default routing matched it
A view file is saved as app/Views/tasks/index.php, but a controller calls return view('Tasks/Index'); using different capitalization. This works on a Windows machine but fails once deployed to a Linux server. What does this reveal? View lookups can be case-sensitive depending on the operating system, so the path passed to view() should match the actual file's case
A single controller can have multiple methods, each corresponding to a different route or page. True
Which function is used inside a CodeIgniter controller method to load and return a View? view()
In MVC, the Model is responsible for rendering HTML and displaying content to the user. False
A controller method needs to send the value $name = 'Maria' to a view so it can be displayed. Which line correctly accomplishes this? return view('profile', ['name' => $name]);
In a default CodeIgniter 4 installation, which folder should be set as the web server's document root for production hosting? public
A developer writes all of an application's HTML directly inside controller methods using echo statements, without using any View files. Why is this generally considered poor practice under the MVC pattern? It mixes presentation code with request-handling logic, making the application harder to maintain
A view file contains the line <h1><?= $title ?></h1>, but the page displays an "Undefined variable $title" error. What most likely caused this? The controller did not pass title in the data array to view()
Why might a developer choose to use a web framework like CodeIgniter instead of writing an application in plain PHP? Frameworks provide reusable structure and tools, reducing repetitive setup work
A team is deciding whether every URL should directly mirror internal controller and method names, or use custom, cleaner routes instead. What is the main benefit of defining custom routes? Custom routes let you design URLs independently of internal class names, so public links do not break when internal code changes
What is the name of the PHP dependency manager commonly used to install CodeIgniter 4? Composer
Which of the following best describes the role of a View in MVC? It focuses only on presentation and displaying data
What is the purpose of the .htaccess file in the public folder of a CodeIgniter project? It removes index.php from the URL through URL rewriting
Every folder inside a CodeIgniter 4 project is meant to be publicly accessible from the web server. False
_______________________________________________________________________ _______________________________________________________________________
(M2)__________________________________________________________________ _______________________________________________________________________
Matching type. Match the term with the correct description.
$table Tells a Model which database table it represents
findAll() Retrieves every record from a Model's table
$allowedFields Restricts which fields may be mass-assigned during insert or update
where() Filters query results based on a condition
_______________________________________________________________________ _______________________________________________________________________
Which line correctly retrieves all tasks with status 'done' using a TaskModel instance $model? $model->where('status', 'done')->findAll();
In the typical CodeIgniter data flow, which component calls the Model to retrieve data before passing it to a View? The Controller
What term describes an unauthorized attempt to manipulate a database through injected SQL, which Query Builder helps prevent? SQL injection
The .env file is used to store view templates. False
What is the name of the CodeIgniter file where database connection settings are typically stored? .env
Which method would you chain to where('status', 'pending') to sort results by creation date, newest first? orderBy('created_at', 'DESC')
Which property in a Model tells CodeIgniter which database table the Model represents? $table
CodeIgniter automatically creates database tables the first time a Model is used. False
Every CodeIgniter application must have at least one Model, even if it does not use a database. False
Chaining where() and orderBy() lets you filter and sort a query in a single statement. True
A Model's $allowedFields property lists the columns permitted for mass assignment. True
Which Query Builder method retrieves a single record by its primary key? find($id)
Comparing SELECT * FROM tasks WHERE status = '$status' (built by directly inserting a variable into a SQL string) against $builder->where('status', $status)->get();, which is safer and why? The Query Builder version, because it automatically escapes the value and reduces SQL injection risk
A table has columns id, title, status, created_at. Which line correctly inserts a new row with only a title? $model->insert(['title' => 'Buy groceries']);
The public folder should contain the application's business logic, including Models. False
A developer hardcodes a task list directly inside a controller using a PHP array, even though a database table for tasks already exists. What is the main drawback? Any change to the task list requires editing code, and the two sources of data can fall out of sync
A team stores database passwords directly inside a Model's PHP file instead of .env. What is the main problem with this? Credentials embedded in code are more likely to be exposed and harder to change per environment than values in .env
Why is CodeIgniter's Query Builder generally considered safer than concatenating raw SQL strings with user input? Query Builder automatically escapes values, reducing the risk of SQL injection
What is the primary purpose of a CodeIgniter Model? To manage data and communicate with the database
Using Query Builder instead of raw SQL strings reduces the risk of SQL injection. True
findAll() returns only the first matching record from a table False
Which Query Builder method retrieves every record from a Model's table? findAll()
What does the $primaryKey property in a Model define? The column CodeIgniter treats as the unique identifier for each row
After correctly configuring .env and creating a Model, a page still throws a database connection error. Which of these is LEAST likely to be the cause? The view has no <title> tag
Which CodeIgniter file typically stores database connection settings such as hostname, username, and database name? .env
What Query Builder method sorts retrieved records by a specific column, ascending or descending? orderBy()
What term describes the special class that represents and manages a specific database table? Model
A view shows "Undefined variable $tasks" even though the Model successfully retrieves records in the controller. What is the most likely cause? The controller did not include tasks in the data array passed to view()
A new priority column is added directly in the database, but $allowedFields is never updated to include it. What happens when a controller tries to save a priority value through this Model? It is silently dropped because $allowedFields still does not list it
findAll() returns only the first matching record from a table. False
A model defines protected $allowedFields = ['title', 'status']; but a controller tries to insert a record that also includes a description value. What happens? The description value is silently ignored because it is not in $allowedFields
A page correctly lists all tasks, but clicking into one specific task shows "Undefined variable $task." The controller has: $data['tasks'] = $model->find($id); return view('tasks/show', $data);. What is the bug? The single record is stored under the plural key 'tasks' but the view expects $task (singular)
What does a Model's $allowedFields property control? Which fields may be mass-assigned during insert() or update()
Matching type. Match the term with the correct description. _______________________________________________________________________
Validation rule Describes what submitted input must satisfy before saving
old() Restores previously submitted input on a redisplayed form
move() Transfers an accepted uploaded file to a target folder
getFile() Reads an uploaded file object from the request
_______________________________________________________________________ _______________________________________________________________________
A controller wants to update an existing user record after validation succeeds. Which Model method is most appropriate? update($id, $data)
What file input form encoding is required for file uploads? multipart/form-data
The uploaded file's original name should always be trusted as the final server filename. False
Which form attribute is required when a CodeIgniter page must upload a file? enctype="multipart/form-data"
What does validation_show_error('title') display in a CodeIgniter view? The validation message for the title field.
A developer allows any uploaded file type because only images are expected. What is the best correction? Use file validation rules for allowed image MIME types and maximum size.
What acronym refers to Create, Read, Update, and Delete operations? CRUD
Validation should normally run after saving the submitted data. False
Why is a random server filename safer than using the uploaded file's original name? It reduces name collisions and avoids trusting user-supplied filenames.
A Model can be used by a controller to insert, update, retrieve, or delete records. True
Why should validation run before insert() or update() in a CodeIgniter controller? It prevents invalid or unsafe input from being saved.
A student saves uploaded avatars before checking file type and size. What is the main risk? Unsafe or unexpected files may already be stored before rejection.
A page successfully saves a customer but displays a blank list afterward. The controller calls return view('customers/index') without passing records. What should be checked first? Whether customer data is retrieved and passed to the view.
File type and file size restrictions help reduce unsafe upload behavior. True
A form field is named email, but the controller validates user_email. What is the most likely result? Validation will not check the submitted email field correctly.
What helper can print the validation error message for one field in a view? validation_show_error()
What is the main purpose of redisplaying old input after validation fails? To let users correct mistakes without retyping every field.
Which CodeIgniter helper function is commonly placed inside a form to include CSRF protection? csrf_field()
old() helps preserve submitted values when a form is redisplayed after validation failure. True
Which approach is best when a real system should avoid permanently deleting user accounts? Use an archive or deactivation status when possible.
A controller receives a submitted title field. Which line safely reads the posted value through CodeIgniter's request object? $this->request->getPost('title');
What CodeIgniter constant points to the public front-controller path, often used when saving files under public/uploads? FCPATH
Which validation rule set best restricts an uploaded avatar to JPG or PNG images no larger than 2 MB? uploaded[avatar]|max_size[avatar,2048]|mime_in[avatar,image/jpg,image/jpeg,image/png]
Which validation rule makes a form field required before the controller saves data? required
A CodeIgniter form that uploads files must use multipart/form-data. True
Why should a Delete action normally be submitted using POST rather than a normal GET link? Destructive actions should not be triggered by simple page visits or crawlers.
What should be saved in the database after a successful public image upload? Only the generated filename or path needed to display the file.
A view should normally decide by itself which database record to delete. False
Which CodeIgniter UploadedFile method generates a safer unique filename before moving the file? getRandomName()
Deleting records through a normal GET link is a safe default for production systems. False
Which line moves an uploaded file object named $file into the public uploads folder using a generated name? $file->move(FCPATH . 'uploads', $newName);
Which statement best describes CRUD? The four record actions: create, read, update, and delete.
_______________________________________________________________________ _______________________________________________________________________
Matching type. Match the term with the correct description. _______________________________________________________________________
Flash data Stores a short message for the next request
Logout Removes the authenticated session state
Session Stores small user-related data across requests
Authentication Verifies that a user is who they claim to be
_______________________________________________________________________ _______________________________________________________________________
Which line is a reasonable way to set session data in CodeIgniter? session()->set(['isLoggedIn' => true]);
A developer stores the full password hash and user role in session after login. What should be evaluated? Whether only necessary, non-sensitive session data is stored.
What is the safest general description of authentication? Confirming a user's identity before allowing access.
Session data can persist across multiple HTTP requests for the same user. True
A team wants every protected controller method to repeat the same session-check code. What is a better long-term approach? Use a reusable check, filter, or shared helper pattern.
Password verification should work against hashed passwords rather than exposing raw passwords. True
What is the primary purpose of a session in a web application? To store small user-related data across multiple requests.
Flash data is intended to last permanently until manually deleted from the database. False
Why should access-control checks happen before displaying protected content? To prevent unauthorized users from seeing restricted pages.
What is the main purpose of logout? To remove the user's authenticated session state.
What should a controller check before showing a protected page? Session/authentication state
A user logs in successfully, but protected pages still redirect to login. What should be checked first? Whether the expected session key is set and read consistently.
What CodeIgniter feature is used for temporary messages such as 'Login successful'? Flash data
Which line is a reasonable way to remove all authentication session data on logout? session()->destroy();
A protected page relies only on hiding menu links, but the route can still be opened manually. What is the main weakness? The server-side access check is missing or incomplete.
A controller checks if session()->get('isLoggedIn') is true before returning the dashboard view. What security goal does this support? Session-based access control
What is flash data best used for? A message that should be available only for the next request.
Session-based authentication removes the need to validate login input. False
Logout should leave the authenticated session values untouched. False
Which behavior indicates a protected page is working correctly? Unauthenticated users are redirected to login.
A protected page should verify the user's authenticated state before showing restricted content. True
Which logout design is stronger? Destroy the session and redirect to login with a short message.
A login page shows 'Invalid credentials' only after a failed attempt and then the message disappears. What feature most likely supports this? Flash data
What should happen after a successful login? Store appropriate user identity data in the session and redirect to a protected page.
What process clears authenticated session data so the user is no longer logged in? Logout
A login workflow usually redirects after successful authentication. True
Which session value would be reasonable to store after login? The logged-in user's id or username.
Which CodeIgniter service is commonly used to access session functionality? session()
What term refers to the process of verifying a user's identity? Authentication
What is a common reason to redirect after processing login? It prevents the same form submission from being repeated by browser refresh.
Hiding a menu link is enough to secure a protected page even if the route remains accessible. False
Why should passwords be verified using a password-checking function rather than comparing plain text? Secure verification works with hashed passwords instead of exposing raw passwords.
Created by: Jsean-Ed
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards