SoloLearn Question and Answer

 SoloLearn Question and Answer


1. What is the output of this code? (PHP)
    
    $secret=(3%5==3)?1:0;
    $answer=(!(6+5>5+5 xor 1)) ? 2+ $secret : 1;
    echo $answer;

ANS-3

2. Which of these attempts to open a file will cause an error due to using single or double quotes? (PHP)
    
    #1
    fopen('myfile.txt','r');
    #2
    fopen("myfile.txt","r");


ANS- None of the attempts


3. Which one is the correct way to instantiate an empty generic object in PHP that can further be modified? (PHP)

        A. $genericObject = new Class();
        B. $genericObject = new Generic();
        C. $genericObject = new stdClass();
        D. $genericObject = new Object();

ANS- C. $genericObject = new stdClass();

4.What is the output of this code?

    $s = 'ABCD';
    $i = 'a';
    echo stripos($s, $i);

        A. 1
        B. 0
        C. No output
        D. Error

ANS-B. 0


Post a Comment

Previous Post Next Post