FORMATIVE 4 Flashcards

(20 cards)

1
Q

How can you specify a table in a Model to interact with?
Group of answer choices

protected $table property

setTable()

useTable()

table()

A

protected $table property

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

What is the primary purpose of a Model in CodeIgniter?
Group of answer choices

Interact with the database

Configure routing

Handle user input

Manage views

A

Interact with the database

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

Which method is commonly used to retrieve all records from a database table using a Model?
Group of answer choices

findAll()

getAll()

retrieveAll()

get()

A

findAll()

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

Which property should be defined in a Model to specify the primary key of the table?
Group of answer choices

protected $primaryKey

protected $id

protected $key

protected $identifier

A

protected $primaryKey

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

What is the default return type of data when using Models in CodeIgniter?
Group of answer choices

Array

JSON

Object

XML

A

Array

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

How can you pass multiple pieces of data to a view?
Group of answer choices

Using an associative array

Using JSON

Using multiple arguments

Using a string

A

Using an associate array

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

Which of the following is true about views in CodeIgniter?
Group of answer choices

Views should only present data, not handle logic

Views should contain database queries

Views can directly manipulate session data

Views should handle form validation

A

Views should only present data, not handle logic

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

Which function is used to load a view in CodeIgniter?
Group of answer choices

view()

load->view()

display_view()

show_view()

A

view()

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

What does the view() function return when loading a view?
Group of answer choices

A string containing the rendered view

Nothing

A boolean

An array

A

A string containing the rendered view

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

What is the primary purpose of a View in CodeIgniter?
Group of answer choices

Present data to the user

Handle database queries

Manage application logic

Route HTTP requests

A

Present date to the user

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

Which method in a Model is used to update an existing record in the database?
Group of answer choices

update()

set()

modify()

change()

A

update()

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

Which function is used to load a Model in CodeIgniter?
Group of answer choices

model()

get_model()

load->model()

use_model()

A

model()

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

What does the save() method do in a Model?

Inserts or updates data based on whether the record exists

Only inserts data into the database

Only updates data in the database

Deletes a record if it exists

A

Inserts or updates data based on whether the record exists

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

How do you validate data before saving it in a Model?
Group of answer choices

Use the $validationRules property

validateData()

checkData()

validateBeforeSave()

A

Use the $validationRules property

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

Which of the following functions can be used to include a CSS file in a view?
Group of answer choices

<link></link>

<link></link>

add_css(‘…’)

load_css(‘…’)

A

<link></link>

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

What is the purpose of using layouts in CodeIgniter views?
Group of answer choices

To create a consistent structure across multiple pages

To load multiple models

To handle database connections

To route user requests

A

To create a consistent structure across multiple pages

17
Q

Which method is used to render a view as a partial within another view?
Group of answer choices

view()

include()

render_partial()

embed_view()

18
Q

Which method can be used to get the number of affected rows from the last database operation?
Group of answer choices

affectedRows()

rowCount()

countRows()

getRowCount()

A

affectedRows()

19
Q

Which method in a Model can be used to insert a new record into the database?
Group of answer choices

insert()

add()

saveData()

create()

20
Q

How do you prevent direct access to view files via URL?
Group of answer choices

Use an .htaccess rule

Set permissions on the file

Rename the file to .view

Load the view using AJAX only

A

Use an. htaccess rule