Online Exam Quiz

questionQuestion  1 to 30

How do you append to a file in PHP?

  • fopen("file.txt", "a");
  • open("file.txt", "a");
  • append("file.txt", "a");
  • file_append("file.txt", "a");
Mark for review

How do you create a cookie in PHP?

  • setcookie("name", "value", time()+3600)
  • createcookie("name", "value", 3600)
  • makecookie("name", "value", 3600)
  • cookie("name", "value", time()+3600)
Mark for review

Which of the following is the correct way to create a function in PHP?

  • function myFunction() { }
  • create myFunction() { }
  • define myFunction() { }
  • function() { }
Mark for review

How do you send a raw HTTP header in PHP?

  • header("HTTP/1.1 200 OK");
  • send_header("HTTP/1.1 200 OK");
  • sendhttp("HTTP/1.1 200 OK");
  • httpheader("HTTP/1.1 200 OK");
Mark for review

Which of the following is a way to comment in PHP?

  • // This is a comment
  • /* This is a comment */
  • # This is a comment
  • All of the above
Mark for review

What does MVC stand for in PHP frameworks?

  • Model View Controller
  • Module View Controller
  • Model View Component
  • Module View Component
Mark for review

What will substr("abcdef", 1, 3); return?

  • bcd
  • abc
  • cde
  • def
Mark for review

What does PHP stand for?

  • PHP: Hypertext Preprocessor
  • Personal Home Page
  • Private Home Page
  • Personal Hypertext Processor
Mark for review

Which of the following is a PHP variable?

  • $var
  • var
  • @var
  • #var
Mark for review

How do you check if a variable is an array in PHP?

  • is_array($var)
  • check_array($var)
  • isArray($var)
  • array_check($var)
Mark for review

Which of the following is used to start an output buffer in PHP?

  • ob_start()
  • buffer_start()
  • start_ob()
  • output_start()
Mark for review

How do you declare an abstract class in PHP?

  • abstract class MyClass { }
  • class abstract MyClass { }
  • class MyClass abstract { }
  • abstract MyClass { }
Mark for review

How can you get the value of a cookie in PHP?

  • $_COOKIE['name']
  • get_cookie("name")
  • fetch_cookie("name")
  • retrieve_cookie("name")
Mark for review

How can you start a session in PHP?

  • session_start()
  • session_begin()
  • start_session()
  • begin_session()
Mark for review

How do you destroy a session in PHP?

  • session_destroy()
  • destroy_session()
  • session_end()
  • end_session()
Mark for review

What is the correct way to create an array in PHP?

  • $array = array("value1", "value2");
  • $array = ("value1", "value2");
  • $array = ["value1", "value2"];
  • $array = {value1, value2};
Mark for review

How do you redirect to another page in PHP?

  • header("Location: page.php");
  • redirect("page.php");
  • move("page.php");
  • location("page.php");
Mark for review

How do you remove all leading and trailing whitespace in PHP?

  • trim($string)
  • strip($string)
  • clean($string)
  • whitespace_remove($string)
Mark for review

How do you delete a file in PHP?

  • unlink("file.txt");
  • delete("file.txt");
  • remove("file.txt");
  • erase("file.txt");
Mark for review

How do you get the current timestamp in PHP?

  • time()
  • timestamp()
  • current_time()
  • now()
Mark for review

Which of the following is the correct way to create a class in PHP?

  • class MyClass { }
  • create class MyClass { }
  • define class MyClass { }
  • class: MyClass { }
Mark for review

What will strtolower("HELLO"); return?

  • hello
  • HELLO
  • Hello
  • hElLo
Mark for review

What will strpos("Hello world", "world"); return?

  • 5
  • 6
  • 7
  • 8
Mark for review

Which of the following is a correct way to open a file in read mode in PHP?

  • fopen("file.txt", "r");
  • fopen("file.txt", "read");
  • open("file.txt", "r");
  • open("file.txt", "read");
Mark for review

How do you find the position of the first occurrence of a substring in a string in PHP?

  • strpos()
  • find()
  • search()
  • locate()
Mark for review

What is the output of echo (int)( (0.1+0.7) * 10 );?

  • 7
  • 8
  • 9
  • 10
Mark for review

How do you convert a string to lowercase in PHP?

  • strtolower($string)
  • lower($string)
  • to_lower($string)
  • string_to_lower($string)
Mark for review

How can you get the number of elements in an array in PHP?

  • count($array)
  • size($array)
  • length($array)
  • elements($array)
Mark for review

Which of the following is the right way to get the length of a string in PHP?

  • strlen($string)
  • length($string)
  • size($string)
  • strlength($string)
Mark for review

Which function is used to output text in PHP?

  • echo
  • print
  • write
  • show
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review