Create New Post

CodeIgniter MCQs with answer part - 4

  1. What is the purpose of the CodeIgniter Session library?

    • A) To handle database interactions
    • B) To manage user authentication
    • C) To store user-specific data across multiple requests
    • D) To generate HTML forms

    Answer: C) To store user-specific data across multiple requests

  2. How do you load the CodeIgniter Session library in a controller?

    • A) $this->load->library('session')
    • B) $this->session->load()
    • C) $this->session->library('session')
    • D) $this->library('session')

    Answer: A) $this->load->library('session')

  3. Which CodeIgniter function is used to set session data?

    • A) set_session_data()
    • B) add_session_data()
    • C) store_session_data()
    • D) set_userdata()

    Answer: D) set_userdata()

  4. How do you retrieve session data in a CodeIgniter controller?

    • A) $this->session->get()
    • B) $this->session->retrieve()
    • C) $this->session->userdata()
    • D) $this->session->fetch()

    Answer: C) $this->session->userdata()

  5. Which of the following is NOT a valid session driver in CodeIgniter?

    • A) File
    • B) Database
    • C) Memory
    • D) Redis

    Answer: C) Memory

  6. What is the purpose of the CodeIgniter Encryption library?

    • A) To encrypt and decrypt sensitive data
    • B) To compress data before storing it
    • C) To hash passwords for user authentication
    • D) To encode data for secure transmission over the network

    Answer: A) To encrypt and decrypt sensitive data

  7. How do you load the CodeIgniter Encryption library in a controller?

    • A) $this->load->library('encryption')
    • B) $this->encryption->load()
    • C) $this->encryption->library('encryption')
    • D) $this->library('encryption')

    Answer: A) $this->load->library('encryption')

  8. Which method is used to encrypt data using the CodeIgniter Encryption library?

    • A) encrypt()
    • B) encode()
    • C) encrypt_data()
    • D) encode_data()

    Answer: A) encrypt()

  9. How do you decrypt data using the CodeIgniter Encryption library?

    • A) decrypt()
    • B) decode()
    • C) decrypt_data()
    • D) decode_data()

    Answer: A) decrypt()

  10. Which CodeIgniter feature is used to execute custom code before and after a controller method is called?

    • A) Filters
    • B) Middleware
    • C) Hooks
    • D) Interceptors

    Answer: C) Hooks

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

92683