0
Alien head

programming languages Online Quiz - 141

Description: programming languages Online Quiz - 141
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

this() is used to invoke a constructor of the same class

  1. True

  2. False


Correct Option: A

non-Unicode letter characters $ and _ cannot be used as the first character of an identifier

  1. True

  2. False


Correct Option: B

void is the return type of a program’s main() method

  1. True

  2. False


Correct Option: A

Exceptions can be rethrown.

  1. True

  2. False


Correct Option: A

A class is a subclass of itself.

  1. True

  2. False


Correct Option: A

“abc” is a primitive value

  1. True

  2. False


Correct Option: B

Static global variable in one c++ file can be used in another c++ file with the help of extern keyword.

  1. True

  2. False


Correct Option: B

string s="tcs". This is a valid c++ syntax.

  1. True

  2. False


Correct Option: A

virtual function defined in the parent class should be redefined in all of its inheriting child classes

  1. True

  2. False


Correct Option: B

An abstract class can have an object defined.

  1. True

  2. False


Correct Option: B

The methods wait() and notify() are defined in

  1. java.lang.Thread

  2. java.lang.Object

  3. java.lang.Runnable

  4. java.lang.ThreadGroup


Correct Option: B

Given the code String s1 = "yes"; String s2 = "yes"; String s3 = new String(s1); Which of the following would equate to true?

  1. s1 == s2

  2. s3 == s1

  3. s1.equals(s2)

  4. s3.equals(s1)


Correct Option: A,C,D

Which of the following are the wrapper classes?

  1. Byte

  2. Integer

  3. Short

  4. String


Correct Option: A,B,C

Which of the following classes are available in the java.lang package?

  1. Object

  2. Math

  3. Random

  4. Stack


Correct Option: A,B

Which of the following statements are valid array declaration?

  1. int number();

  2. float average[];

  3. double[] marks;

  4. counter int[];


Correct Option: B,C

1)main() { static int a[]={0,1,2,3,4}; int p[]={a,a+1,a+2,a+3,a+4}; int *ptr=p; ptr++; printf(“\n%d%d%d”ptr-p,ptr-a,ptr); ptr++; printf(“\n%d%d%d”ptr-p,ptr-a,ptr); ++ptr; printf(“\n%d%d%d”ptr-p,ptr-a,ptr); ++*ptr; printf(“\n%d%d%d”ptr-p,ptr-a,**ptr); }

  1. 123 234 340 012

  2. 111 222 333 444

  3. 111 222 444 333

  4. 012 340 234 123


Correct Option: B

1)main() { int a[2][3][2]={{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(“%u %u %u %d”,a,a,a,a); printf(“%u %u %u %d\n”,a+1,*a+1,a+1,***a+1); } Provided base address of a is 100.

  1. 100 100 100 2 112 104 102 3

  2. 100 104 108 3 112 116 120 3

  3. 100 100 100 2 112 104 102 2

  4. 100 104 108 2 112 116 120 2


Correct Option: A

1)#define square(x) x*xmain(){ int i; i=64/square(4); printf(“%d”,i);}

  1. 32

  2. 4

  3. 64

  4. 16


Correct Option: C

1)void main() { int const p = 5; printf(“%d”,++(p)); }

  1. 6

  2. junk value

  3. some address

  4. error


Correct Option: D

1)main() { int i = 5; printf(“%d %d %d %d %d”,i++,i--,++i,--i,i); }

  1. 5 6 6 5 5

  2. 6 5 6 5 5

  3. 5 5 6 5 5

  4. 4 5 5 4 5


Correct Option: D
+ View questions