Web Sys Tech: Summative 2

0.0(0)
studied byStudied by 12 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/56

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

57 Terms

1
New cards

Where are Model files typically stored in a CodeIgniter application?

app/Models

app/Controllers

app/Views

app/Config

app/Models

2
New cards

Which method is used to delete a record from the database using a Model?

delete()

remove()

destroy()

erase()

delete()

3
New cards

How do you prevent direct access to view files via URL?

Use an .htaccess rule

Set permissions on the file

Rename the file to .view

Load the view using AJAX only

Use an .htaccess rule

4
New cards

Which function is used to load a view in CodeIgniter?

view()

load->view()

display_view()

show_view()

view()

5
New cards

How do you validate data before saving it in a Model?

Use the $validationRules property

validateData()

checkData()

validateBeforeSave()

Use the $validationRules property

6
New cards

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

Array

JSON

Object

XML

Array

7
New cards

Which method in a Model is used to retrieve a single row of data by its primary key?

find()

fetchRow()

retrieve()

getOne()

find()

8
New cards

What does the esc() function do in a view?

Escapes HTML characters to prevent XSS attacks

Exits the script

Includes a JavaScript file

Creates a new line in the HTML

Escapes HTML characters to prevent XSS attacks

9
New cards

What is the purpose of using layouts in CodeIgniter views?

To create a consistent structure across multiple pages

To load multiple models

To handle database connections

To route user requests

To create a consistent structure across multiple pages

10
New cards

Which of the following is true about views in CodeIgniter?

Views should only present data, not handle logic

Views should contain database queries

Views can directly manipulate session data

Views should handle form validation

Views should only present data, not handle logic

11
New cards

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

affectedRows()

rowCount()

countRows()

getRowCount()

affectedRows()

12
New cards

Which method in a Model is used to update an existing record in the database?

update()

set()

modify()

change()

update()

13
New cards

Which of the following methods in CodeIgniter is used to pass data?

assign()

data()

$this->set()

with()

assign()

14
New cards

How can you specify a table in a Model to interact with?

protected $table property

setTable()

useTable()

table()

protected $table property

15
New cards

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

findAll()

getAll()

retrieveAll()

get()

findAll()

16
New cards

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

insert()

add()

saveData()

create()

insert()

17
New cards

What does the view() function return when loading a view?

A string containing the rendered view

Nothing

A boolean

An array

A string containing the rendered view

18
New cards

Where are the view files typically stored in a CodeIgniter application?

app/Views

app/Models

app/Controllers

App/Config

app/Views

19
New cards

Which method is used to render a view as a partial within another view?

view()

include()

render_partial()

embed_view()

view()

20
New cards

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

protected $primaryKey

protected $id

protected $key

protected $identifier

protected $primaryKey

21
New cards

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

Inserts or updates data based on whether the record exists

22
New cards

What is the primary purpose of a View in CodeIgniter?

Present data to the user

Handle database queries

Manage application logic

Route HTTP requests

Present data to the user

23
New cards

What is the primary purpose of a Model in CodeIgniter?

Interact with the database

Configure routing

Handle user input

Manage views

Interact with the database

24
New cards

What is the purpose of the returnType property in a Model?

Specifies the format of returned data (e.g., array, object)

Defines the format for errors

Specifies the data type of the primary key

Configures the database connection

Specifies the format of returned data (e.g., array, object)

25
New cards

How can you access data passed from the controller in a view file?

As variables

Using $this->data

Using an array

Using objects

As variables

26
New cards

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

add_css('...')

load_css('...')

27
New cards

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

Using an associative array

Using JSON

Using multiple arguments

Using a string

Using an associative array

28
New cards

Which method is used to send data from a view back to the controller?

Data is not sent back; it's typically handled via forms

view->data()

transfer_data()

return_data()

Data is not sent back; it's typically handled via forms

29
New cards

It is a class file that can be associated with a URI.

Control

Function

Controller

Controller

30
New cards

The default controller can be set from which configuration file:

Database

Config

Routes

Autoload

Routes

31
New cards

T/F: Controllers are the heart of your application, as they determine how HTTP requests should be handled.

True

32
New cards

T/F: Views are called directly and must be loaded by a controller.

False

33
New cards

T/F:An example of storing view within sub-directories: $this->load->v('subdirectory_name/file_name');

False

34
New cards

T/F:The .php file extension does not need to be specified unless you use something other than .php.

True

35
New cards

T/F:The application/config/routes.php file determines which controller is called by default

False

36
New cards

T/F: This has an invalid class name:

True

37
New cards

To load a view file you will use the following method:

$this->load->data('name');

$this->load->file('name');

$this->load->view('name');

$this->load->view('name');

38
New cards

T/F: An example of storing view within sub-directories: $this->view('subdirectory_name/file_name');

False

39
New cards

T/F: CodeIgniter will handle multiple calls to $this->load->view() from within a controller.

True

40
New cards

T/F:Controller should extends the parent controller class so that it can inherit all its methods.

False

41
New cards

T/F: In an MVC framework, the Controller acts as the orchestrator, so it is responsible for fetching a particular view.

True

42
New cards

T/F: An example of storing view within subdirectories: $this->load->view("directory_name/file_name");

True

43
New cards

T/F: A view is simply a web page, or a page fragment (header, footer) and can be embedded within other views.

True

44
New cards

. _______ is an Application Development Framework - a toolkit - for people who build web sites using PHP.

Joomla

Zend

CodeIgniter

Wordpress

CodeIgniter

45
New cards

T/F: Class names must start with an uppercase letter.

True

46
New cards

List features of Codeigniter?

Model View Controller support System

Extremely Light Weight

Full Featured database classes with compatibility to several platforms

All of these

All of these

47
New cards

T/F: Views are called directly and must be loaded by a controller.

False

48
New cards

T/F: A Controller is a class file that can be associated with a URI.

True

49
New cards

T/F: CodeIgniter will intelligently handle multiple calls to $this->load->view() from within a controller.

True

50
New cards

T/F:Data is passed from the controller to the view by way of an array in the second parameter of the view loading method.

True

51
New cards

In the example: example.com/index.php/blog/, the , CodeIgniter would attempt to?

Create a class bolg

Find a controller named Blog.php

Call a function blog

Find a controller named Blog.php

52
New cards

T/F: If your URI contains more than two segments they will be passed to your method as function

False

53
New cards

T/F: CodeIgniter can load a default controller if only your site root URL is requested.

True

54
New cards

In this example: example.com/class/function/ID/foo/bar, what is the controller class?

example.com

class

Function

class

55
New cards

What is the file extension typically used for view files in CodeIgniter?

.php

.html

.xml

.view

.php

56
New cards

Which function is used to load a Model in CodeIgniter?

model()

get_model()

load->model()

use_model()

load->model()

57
New cards

GOODLUCK BTCHES :)