Ubinetics Previous Years Solved Sample Placement Papers
-
What is the use of fopen() function in PHP?
A. The fopen() function is used to open folders in PHP
B. The fopen() function is used to open remote server
C. The fopen() function is used to open files in PHP Answer: Option C
D. None of the above
- Solution: PHP fopen() function is used to open files or URLs and returns a resource. It accepts two arguments: $filename and $mode. The $filename represents the file to be opened, and $mode represents the file mode, e.g., read-only, read-write, write-only, etc.
-
What is the use of isset() function in PHP?
A. The isset() function is used to check whether a variable is set or not Answer: Option A
B. The isset() function is used to check whether the variable is free or not
C. The isset() function is used to check whether the variable is a string or not
D. None of the above
- Solution: The isset() function is a built-in function in PHP used to determine whether a variable is set. If a variable is considered set, it means the variable is declared and has a different value from NULL. This function returns true if the variable is not null; otherwise, it returns false.
-
What is the use of sprintf() function in PHP?
A. The sprintf() function is used to print the output of a program
B. The sprintf() function is used to send output to a variable Answer: Option B
C. Both of the above
D. None of the above
- Solution: The sprintf() function is an in-built function in PHP that writes a formatted string to a variable. Unlike printf(), it saves the output into a string instead of displaying it on the browser.
-
Which of the following is the correct way to open the file "sample.txt" as readable?
A. fopen("sample.txt", "r"); Answer: Option A
B. fopen("sample.txt", "r+");
C. fopen("sample.txt", "read");
D. fopen("sample.txt");
- Solution: The fopen() function accepts two arguments: $filename and $mode. The $filename represents the file to be opened, and $mode represents the file mode. The "r" mode opens the file in read-only mode, placing the file pointer at the beginning of the file.
-
Which of the following function displays the information about PHP and its configuration?
A. php_info()
B. phpinfo() Answer: Option B
C. info()
D. None of the above
- Solution: The phpinfo() function gives information about the PHP configuration and installation. It is generally used to check configuration settings.
-
Which of the following function is used to find files in PHP?
A. glob() Answer: Option A
B. fold()
C. file()
D. None of the above
-
Which of the following must be installed on your computer so as to run PHP script?
i) Adobe Dreamweaver
ii) PHP
iii) Apache
iv) IIS
A. All of the mentioned
B. Only (ii)
C. (ii) and (iii)
D. (ii), (iii) and (iv) Ans: D
-
We can use ___ to comment a single line?
i) /?
ii) //
iii) #
iv) /* */
A. Only (ii)
B. (i), (iii) and (iv)
C. (ii), (iii) and (iv) Ans: C
D. Both (ii) and (iv)
-
Which of the below symbols is a newline character?
A. \r
B. \n Ans: B
C. /n
D. /r
-
Which of the following PHP statement/statements will store 111 in variable num?
i) int $num = 111;
ii) int mum = 111;
iii) $num = 111;
iv) 111 = $num;
A. Both (i) and (ii)
B. All of the mentioned.
C. Only (iii) Ans: C
D. Only (i)
-
What will be the output of the following PHP code?
A. 3
B. 1+2 Ans: B
C. 1.+.2
D. Error
-
What will be the output of the following PHP code?
A. 3 Ans: A
B. 1+2
C. Error
D. 12
-
Which of the following variables can be assigned a value to it?
(i) $3hello
(ii) $_hello
(iii) $this
(iv) $This
A. All of the mentioned
B. Only (ii)
C. (ii), (iii) and (iv)
D. (ii) and (iv) Ans: D
-
What will be the output of the following code?
A. Error
B. My name is BobBob
C. My name is BobMy name is Bob
D. My name is Bob Bob Ans: D
-
Which function returns an array consisting of associative key/value pairs?
A. count()
B. array_count()
C. array_count_values() Answer: Option C
D. count_values()
-
The updated MySQL extension released with PHP 5 is typically referred to as:
A. MySQL
B. mysql
C. mysqli Answer: Option C
D. mysqly
-
Which one of the following statements is used to create a table?
A. CREATE TABLE table_name (column_name column_type); Answer: Option A
B. CREATE table_name (column_type column_name);
C. CREATE table_name (column_name column_type);
D. CREATE TABLE table_name (column_type column_name);
-
Which one of the following statements can be used to select the database?
A. $mysqli=select_db(‘databasename’);
B. mysqli=select_db(‘databasename’);
C. mysqli->select_db(‘databasename’);
D. $mysqli->select_db(‘databasename’); Answer: Option D
-
Which of the methods are used to manage result sets using both associative and indexed arrays?
A. get_array() and get_row()
B. get_array() and get_column()
C. fetch_array() and fetch_row() Answer: Option C
D. fetch_array() and fetch_column()
-
Which two predefined variables are used to retrieve information from forms?
A. $GET & $SET
B. $_GET & $_SET Answer: Option B
C. $__GET & $__SET
D. GET & SET
-
When you use the $_GET variable to collect data, the data is visible to:
A. None
B. Only you
C. Everyone Answer: Option C
D. Selected few