Create New Post

CodeIgniter MCQs with answer part - 2

  1. What is the default database driver used in CodeIgniter?

    • A) MySQL
    • B) SQLite
    • C) PostgreSQL
    • D) MongoDB

    Answer: A) MySQL

  2. Which file contains the database configuration settings in a CodeIgniter project?

    • A) application/config/database.php
    • B) application/config/config.php
    • C) system/database/config.php
    • D) system/config/database.php

    Answer: A) application/config/database.php

  3. How do you load a model in a CodeIgniter controller?

    • A) $this->model('Model_name')
    • B) $this->load_model('Model_name')
    • C) $this->load->model('Model_name')
    • D) $this->import_model('Model_name')

    Answer: C) $this->load->model('Model_name')

  4. Which CodeIgniter library is used for form validation?

    • A) Form_Validation
    • B) Input_Validation
    • C) Validation_Helper
    • D) Form_Helper

    Answer: A) Form_Validation

  5. How do you set validation rules for form fields in CodeIgniter?

    • A) By calling the set_rules() method
    • B) By using HTML5 attributes in the form fields
    • C) By creating custom validation functions
    • D) By defining rules in the controller constructor

    Answer: A) By calling the set_rules() method

  6. Which method is used to handle form submissions and validate input in CodeIgniter controllers?

    • A) handle_submission()
    • B) validate_input()
    • C) submit_form()
    • D) form_validation->run()

    Answer: D) form_validation->run()

  7. How do you set flashdata messages in CodeIgniter?

    • A) set_flashdata()
    • B) flash_message()
    • C) set_message()
    • D) add_message()

    Answer: A) set_flashdata()

  8. Which of the following is NOT a valid session driver supported by CodeIgniter?

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

    Answer: B) Database

  9. How can you access session data in a CodeIgniter controller?

    • A) Using the $this->session->get() method
    • B) Using the $this->session->userdata() method
    • C) Using the $this->session_data() function
    • D) Using the $this->get_session_data() method

    Answer: B) Using the $this->session->userdata() method

  10. Which of the following is NOT a valid HTTP request method in CodeIgniter?

    • A) GET
    • B) POST
    • C) DELETE
    • D) MODIFY

    Answer: D) MODIFY

Comments

Leave a Reply

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

70000