CS508 Quiz 2 Solution and Discussion

In java, explicit conversion of primitive type is done by _________ CS508
aliasing
boxing
casting
overloading

_____ is used to initialize values of arrays in C++ and Java. CS508
[]
()
{}

CS508 - Modern Programming Languages - Q. No. 1

In C# Managed code is executed under the control of

            CLR

            CRL

CS508 - Modern Programming Languages - Q. No. 2

_____is more strongly typed language then _________

            C++, C#

            C#, C++

            C++, Java

            None of then given

CS508 - Modern Programming Languages - Q. No. 3

The IS operator in C# is used for_________

            Run time type conversion

            Run time type checking

            Run time type casting

            None of the given

CS508 - Modern Programming Languages - Q. No. 4

PHP is a __________typed language.

            Strongly

            Dynamic

            Static

            None of Given

CS508 - Modern Programming Languages - Q. No. 5

____ compile into machine independent language, independent code which run in a managed execution environment.

            C#

            Java

            C++

            Ada

CS508 - Modern Programming Languages - Q. No. 6

PHP supported all major Databases including______.

            ODBC

            Oracle

            SQL Server

            None Of given

CS508 - Modern Programming Languages - Q. No. 7

______compile initially to an intermediate. Which can be run by interpretation or just in time compilation or an appropriate virtual machine?

            C++ and C#

            C# and Java

            Java and C++

            Ada , C++

CS508 - Modern Programming Languages - Q. No. 8

The keyword unsafe is used while dealing with_____

            Loop

            Arrays

            Pointers

            Classes

CS508 - Modern Programming Languages - Q. No. 9

Enumeration type in C# may take any type of _______ in contrast to C++ where it take only _________

            Numeric value, integer value

            Value type value, numeric value

            Primitive type value, reference type value

            Value type value, reference type value

CS508 - Modern Programming Languages - Q. No. 10

Tasks in ____are processes and cannot share data but thread in _______ do it.

            C# , C++

            C++ , Ada

            Java , C#

            Ada , Java

CS508 - Modern Programming Languages - Q. No. 11

C# code when compiled is converted into ________ code.

            MSIL

            MISL

CS508 - Modern Programming Languages - Q. No. 12 of

In C# _____can be inherited from other class but no inheritance from it. On the other hand _________ cannot be inherited not inheritance is possible from it is possible.

            Private class , public class

            Sealed class ,struct in C#

            struct in C# , Sealed class

            public class , inherited class

CS508 - Modern Programming Languages - Q. No. 13

The concept of sealed class in C# is similar to ________

            Struct in C#,

            Struct in C++

            Abstract class in C#

            None of the given

CS508 - Modern Programming Languages - Q. No. 14

Managed or safe code in_______ is executed under the control of common language runtime (CLR) with automatic garbage collection, no explicit memory allocation and de allocation and no explicit destructor.

            C++

            Java

            Ada and C++

            C#

CS508 - Modern Programming Languages - Q. No. 15

In C# the if statement condition is an/a ________

            Arithmetic expression

            Boolean expression

            Numeric expression

            Both Numeric expression and Boolean expression

CS508 - Modern Programming Languages - Q. No. 16

Java code when compiled is converted into ________ code.

            Bit code

            Byte code

            Kbytes code

            Giga byte Code

CS508 - Modern Programming Languages - Q. No. 17

PHP is a __________typed language.

            Strongly

            Dynamic

            Static

            None of Given

CS508 - Modern Programming Languages - Q. No. 18

In ______ the relationship between a get and set method is inherited, while in ___________ it has to be maintained.

            Java , C++

            C++ , C#

            Ada , Java

            C# , Java or C++

CS508 - Modern Programming Languages - Q. No. 19

C# code when compiled is converted into ________ code.

            MSIL

            MISL

CS508 - Modern Programming Languages - Q. No. 20

In______ Boolean expression is convertible into integer type.

            C#

            C++

            JAVA

            Ada

CS508 - Modern Programming Languages - Q. No. 21

PHP syntax looks like ____________

            ASP syntax

            C/C++ syntax

CS508 - Modern Programming Languages - Q. No. 22

For narrowing conversion which type conversion is appropriate?

            Implicit Conversion

            Explicit Conversion

CS508 - Modern Programming Languages - Q. No. 23

In Java we can make pointer of_________.

            Any type

            Reference type only

CS508 - Modern Programming Languages - Q. No. 24

In C# the value type and reference type variable are interconvert able through ________ concept.

            Tagged type

            Boxing

            Interfaces

            None of the given

CS508 - Modern Programming Languages - Q. No. 25

C# support only_________ inheritance and it achieve_________ inheritance through the concept of interfaces.

            Multiple, multiple

            Single, multiple

CS508 - Modern Programming Languages - Q. No. 26

Tasks in ____are processes and cannot share data but thread in _______ do it.

            C# , C++

            C++ , Ada

            Java , C#

            Ada , Java

CS508 - Modern Programming Languages - Q. No. 27

The concept of package in Java is similar to _________

            Assembly in C#

            Global class in C#

CS508 - Modern Programming Languages - Q. No. 28

The concept of C# jagged array is similar in function to _________

            C++ rectangular Array

            Java Array of Array

            Java pointer Array

            C# Array

CS508 - Modern Programming Languages - Q. No. 29

In C# _____can be inherited from other class but no inheritance from it. On the other hand _________ cannot be inherited not inheritance is possible from it is possible.

            Private class , public class

            Sealed class ,struct in C#

            struct in C# , Sealed class

            public class , inherited class

CS508 - Modern Programming Languages - Q. No. 30

The concept of sealed class in C# is similar to ________

            Struct in C#,

            Struct in C++

            Abstract class in C#

            None of the given

____ compile into machine independent language, independent code which run in a managed execution environment. CS508

C#.
Java.
C++.
Ada

Dealing with unsafe/unmanaged code in _______ we have to compromise on the type safety. CS508
C++
C#
Java
Ada

Question # 1 of 10 ( Start time: 11:23:02 PM ) Total Marks: 1
The _________ in Java is passed by value but ______ is passed by reference.
Select correct option:
Object , Parameters
Parameters , Object
Arguments , Reference type
Reference type , Primitive type

Question # 2 of 10 ( Start time: 11:23:42 PM ) Total Marks: 1
Which of the following are the types of constants in Prolog
Select correct option:
atoms and numbers.
single and decimal
short and char
float and numbers

Question # 3 of 10 ( Start time: 11:23:58 PM ) Total Marks: 1
In Java the ______________are not objects. All of the rest are objects, or any ___________ is called as object.
Select correct option:
generic type , reference type
primitive types , generic type
Reference type , generic type
Reference type , primitive types

Question # 4 of 10 ( Start time: 11:24:35 PM ) Total Marks: 1
In Java which of the following is not Primitive Type
Select correct option:
byte
short
decimal
int

Question # 5 of 10 ( Start time: 11:24:56 PM ) Total Marks: 1
Prolog is considered to be as ________
Select correct option:
case and type insensitive
case and type sensitive
case sensitive and type insensitve
case insensitive and type sensitive

Question # 6 of 10 ( Start time: 11:25:14 PM ) Total Marks: 1
In Prolog language____is used for comments.
Select correct option:
//
%
&

Question # 7 of 10 ( Start time: 11:25:25 PM ) Total Marks: 1
Method that would be free functions in _________(not members of any class) should be static method in _________.
Select correct option:
Java , C#
C++ , C#
Java , C++
C++ , Java

Question # 8 of 10 ( Start time: 11:25:42 PM ) Total Marks: 1
For inheritance we use______ for interface we use________ keywords.
Select correct option:
subclass:baseclass , virtual function
overloaded , virtual
extend , implement
virtual function , overloaded

Question # 9 of 10 ( Start time: 11:26:12 PM ) Total Marks: 1
In ________ for final fields and methods the value is assigned later but in ______ you assign the value during declaration.
Select correct option:
Java , C++
C++ , C#
Java , C#
C++ ,Java

Question # 10 of 10 ( Start time: 11:26:41 PM ) Total Marks: 1
The Java Bytecode is created by the Java compiler and is stored in ____ file
Select correct option:
.exe
.sys
.class
.jvm

Which of the following is not true about delegates? CS508
Delegates are value type
Delegates are reference type
Delegates are similar to function pointers. C/C++

Page 128
Delegates are similar to function pointers. C/C++ function pointers lack instance-based
knowledge whereas C# delegate are event based can be thought of a call-back mechanism
where a request is made to invoke a specified method when the time is right.

In Java, out-of-bounds array index always causes a _______ error. CS508
Syntax
run time

In C# _____can be inherited from other class but no inheritance from it. On the other hand _________ cannot be inherited and not inheritance from it is possible.

In Prolog language____is used for comments. CS508
//
%
\
**

In Prolog % is used to write a comment just like // in C++. That is after % everything till the end of the line is a comment.

Which of the following is not primitive type in java?
86a6917c-9074-404f-863d-280083de8860-image.png

Array

There are _____ “categories” of types in java.
076ae44f-b5f0-493f-ad23-b8db59251b4c-image.png

Enumeration type in C# may take any type of _______ in contrast to C++ where it take only _________

1bc65b9e-d842-4002-a91c-5dd3ea836521-image.png

In C# the value type and reference type variable are inter convertible through ________ concept.
325c2f98-f3bb-4318-b678-fb3af296956b-image.png

The concept of C# jagged array is similar in function to _________

8056777b-4ad5-4408-9643-b37d3a3a9744-image.png

_____is more strongly typed language then _________

2d697bc2-cde8-4501-9a41-c667219d820d-image.png

In Java the ______________are not objects. All of the rest are objects, or any ___________ is called as object.
4fcc2c32-74ee-4164-90a5-64dbba771d40-image.png

For event driven mechanism in C# we use _______ just like ____ in C++.

![0_1579519179051_8a3df806-c808-40ee-952e-c020d317d1d2-image.png](Uploading 100%)

In C#, strings are _______

8c9e846e-8ad8-4edc-90ce-b857907dea4a-image.png