Friday, May 31, 2013

PHP MCQ Test – 1

Que.1. Use the ___________ to delete the data inside the table, and not the table itself?
A.    DEOP TABLE
B.    DELETE TABLE
C.    TRUNCATE TABLE
D.    REMOVE TABLE

Right Answer: C

Que.2. In mail($param1, $param2, $param3, $param4), the $param2 contains:
A.    The message
B.    The recipient
C.    The header
D.    The subject

Right Answer: D

Que.3. Which of the following delimiter is ASP style?
A.    <% %>
B.    <? ?>
C.    <script language=”php”></script>
D.    All of the above

Right Answer: A

Que.4. What is the purpose of basename() function in PHP?
A.    Returns the last accessed time of the file
B.    Returns the first accessed time of the file
C.    Strips of the path and returns the file name.
D.    Strips of the path the returns of the folder name.

Right Answer: C

Que.5. In PHP, fgets() is used to read a file one line at a time.
A.    TRUE
B.    FALSE

Right Answer: A

Que.6. Which of the following statement produce different output
A.    <? echo “this is php example”; ?>
B.    <P=”This is php example”;?>
C.    <?php echo “This is php example”; php?>
D.    <script language=”php”>print “This is php example”;</script>

Right Answer: C

Que.7. Which of the following data type is compound datatype supported by PHP.
A.    Array
B.    String
C.    Float
D.    Boolean

Right Answer: A

Que.8. Which of the following functions in PHP do not return a timestamp?
A.    time()
B.    date()
C.    strtotime()
D.    localtime()
E.    gmmktime()

Right Answer: BD

Que.9. Which of the following are valid float values?
A.    4.5678
B.    4
C.    7.00E+04
D.    All of the above

Right Answer: D

Que.10. Which of the following type specifier is invalid in printf() functions.
A.    %  a
B.    %  b
C.    %  c
D.    %  d

Right Answer: A

Que.11. Transactions are used to treat sets of SQL statements atomically.
A.    TRUE
B.    FALSE

Right Answer: A

Que.12. How does the identity operator ===compare two values in PHP?
A.    It converts them to common compatible data type and then compares the resulting values.
B.    It returns True only if they are both of the same type and value
C.    If the two values are strings, it performs a lexical comparison
D.    It based its comparison on the C strcmp function exclusively
E.    It converts both values to strings and compares them

Right Answer: B

Que.13. Which of the following is not an SQL aggregate function?
A.    AVG
B.    SUM
C.    MIN
D.    MAX
E.    CURRENT_DATE()

Right Answer: E

Que.14. The _____________ statement is used to delete a table in MySQL.
A.    DROP TABLE
B.    DELETE TABLE
C.    DEL TABLE
D.    REMOVE TABLE

Right Answer: A

Que.15. The ____________function parses an English textual date or time into Unix timestamp in PHP.
A.    strtodate()
B.    stroftime()
C.    strtotime()
D.    str_to_time()

Right Answer: C

Que.16. Which function(s) in PHP computes the difference of arrays?
A.    array_diff
B.    diff_array
C.    arrays_diff
D.    diff_arrays

Right Answer: A

Que.17. ______________ Returns the time of sunrise for a given day / location in PHP.
A.    datesunrise()
B.    date_sunrise()
C.    date-sunrise()
D.    date.sunrise()

Right Answer: B

Que.18. What is the difference between print() and echo() in PHP?
A.    echo can take multiple parameters where as print not
B.    print has a return value of 1 so it can be used in expressions where as echo has a void return type
C.    echo() can be used in the CLI version of PHP, while print() can’t
D.    print() can be used in the CLI version of PHP, while echo() can’t
E.    There’s no difference: both functions print out some text!

Right Answer: AB

Que.19. The ___________ function is used to read a single character from a file in PHP.
A.    fgetc()
B.    fgets()
C.    fget()
D.    fgetf()

Right Answer: A

Que.20. In PHP, which of the following(s) count elements in an array?
A.    count
B.    Sizeof
C.    Array_Count
D.    Count_array

Right Answer: AB


.NET MCQ Test – 1

Que.1. Which query expression is used to limit the number of results?
A.    Skip
B.    Take
C.    Where
D.    D.Select

Right Answer: B

Que.2. Which of the following are required to enable users to change the title of web part?
A.    CatalogZone
B.    TitleZone
C.    EditorZone, AppearanceEditorPart
D.    WebPart

Right Answer: C

Que.3. Application_Start event is available in which file?
A.    Global.asax
B.    Local.asax
C.    Web.config
D.    None

Right Answer: A

Que.4. Why should you write the cleanup code in finally block?
A.    Compiler throws an error if you close the connection in try block.
B.    Resource cannot be destroyed in catch block.
C.    Finally blocks run whether or not exception occurs.
D.    All choices are correct.

Right Answer: C

Que.5. Which LINQ statement defines the range variable in a LINQ query?
A.    from
B.    select
C.    join
D.    where

Right Answer: A

Que.6. Which of the following are correct?
1.    Delegates are like C++ function pointers.
2.    Delegates allow methods to be passed as parameters.
3.    Delegates can be used to define callback methods.
4.    Delegates are not type safe.

A.    1,3,4
B.    1,2,3
C.    2,3,4
D.    All are correct

Right Answer: B

Que.7. Which of the following is true?
A.    DataTable object contain DataRow and DataColumn objects
B.    DataSet and DataTable can be binary serialized
C.    DataSet and DataTable can be XML serialized
D.    All choices are correct

Right Answer: D

Que.8. namespace A
{
class MyClass
{
public void fun()
{
Consol.WriteLine(“C # is fun”);
}
}
namespace B
{
class MyClass
{
public void fun()
{
Console.WriteLine(“C # is interesting”);
}
}
}
}
Consider the above code what will be the output of following program

class Program
{
static void Main(string[] args)
{
A.MyClass obj = new A.MyClass();
obj.fun();
}
}

A.    C # is interesting
B.    C # is fun
C.    compiler time error
D.    None

Right Answer: B

Que.9. Which of the following are correct?
1.    Indexers enable objects to be indexed in a similar manner to arrays.
2.    The this keyword is used to define the indexers.
3.    Indexers can be overloaded.
4.    Indexer cannot be used in interface.

A.    1,2
B.    3
C.    1,2,3
D.    None

Right Answer: C

Que.10. Which of the following are correct?
Properties in .NET can be declared as
1.    Static, Protected internal, Virtual
2.    Public, internal, Protected internal
3.    Only public
4.    None

A.    1,2
B.    3
C.    1,2,3
D.    4

Right Answer: A

Que.11. class Myclass
{
public in count = 0;
public Myclass()
{
Count++;
}
}


class Program
{
Static void Main (string[] args)
{
Myclass obj1 = new Myclass(); Console.WriteLine(obj1.count);
Myclass obj2 = new Myclass(); Console.WriteLine(obj2.count);
Myclass obj3 = new Myclass(); Console.WriteLine(obj3.count);
}
}

A.    1,1,1
B.    1,2,3
C.    0,1,2
D.    All of the above

Right Answer: A

Que.12. An interface ca contain declaration of
A.    Methods, properties, events, indexers
B.    Methods
C.    Static members
D.    All of the above

Right Answer: A

Que.13. int[] numbers ={5,4,11,3,9,8,7,2,0};
var nums = numbers.Skip(4);

foreach(var n in nums)
{
Console.Write(n+””);
}

A.    9 8 6 7 2 0
B.    5 4 11 3 9 8
C.    5 4 11 3
D.    None

Right Answer: A

Que.14. int[] A= {0,2,4,5,6,8,9};
int[] B = {1,3,5,7,8};

IEnumerable<int> nums = A.Except(B);

foreach(var n in nums)
{
Console.Write(n+ “”);
}

A.    0,2,4,5,6,8,9
B.    1,3,5,7,8
C.    0,2,4,6,9
D.    All of the above

Right Answer: C

Que.15 Choose the correct one.
int[] numbers = {9,4,1,3,8,6,7,2,1};

var nums = numbers.Take(3);
foreach(var n in nums)
{
Console.WriteLine(n);
}

A.    7 2 1
B.    9 4 1
C.    3 8 6
D.    1 4 9

Right Answer: B

Que.16. int[] A = {0,2,4,56,8};
int[] B = {1,3,5,7,8};

var nums = A.Unioin(B);
foreach(var n in nums)
{
Consol.Write(n+ “”);
}
A.    0 2 4 5 6 8 1 3 5 7 8
B.    0 2 4 5 6 8 1 3 7
C.    0 1 2 3 4 5 6 7 8
D.    None

Right Answer: B

Que.17. Which of the following are correct?
1.    An interface can be instantiated directly.
2.    Interfaces can contain constructor.
3.    Interfaces contain no implementation of methods.
4.    Classes and structs can implement more than one interface.
5.    An interface itself can inherit from multiple interfaces.

A.    3,4,5
B.    1,2,3
C.    2,3,4
D.    All are correct

Right Answer: A

Que.18. From the following which works client side?
A.    ViewState
B.    HiddenField
C.    ControlState
D.    All Choices are correct

Right Answer: D

Que.19. namespace A
{
class MyClass
{
public void fun()
{
Console.WriteLine(“C # is fun”);
}
}
Namespace B
{
class MyClass
{
public void fun()
}
Console.WriteLine(“C # is interesting”);
}
}
}
}

Consider the above code what will be the output of the following program

class Program
{
Static void Main(string[] args)
{
A.B.MyClass obj = new A.B.MyClass();

Obj.fun();
}
}

A.    C # is interesting
B.    C # is fun
C.    Compile time error
D.    None

Right Answer: A

Que.20. From the following which works server side?
A.    ViewState
B.    HiddenField
C.    Application and session
D.    All choices are correct

Right Answer: C