0

programming languages Online Quiz - 287

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

"toString" is a method of Class String.

  1. True

  2. False


Correct Option: B

Can you instantiate "Math" class

  1. True

  2. False


Correct Option: B

main(){ int i=100,j=10,k=20; int sum; float ave; char myformat[]="ave=%.2f"; sum=i+j+k; ave=sum/3; printf(myformat,ave); }

  1. Compile error

  2. ave=43.33

  3. link error

  4. ave= 43.00


Correct Option: D

What would be the output of the following: class A { A() const; //... };

  1. Compile-Time Error

  2. Run time error

  3. Default construtor is called

  4. none of the above


Correct Option: A

main(){ int x=5; printf("%d %d %d\n", x,x<<2,x=x>>2); }

  1. 5 4 1

  2. 1 4 1

  3. 5 20 1

  4. Compile error


Correct Option: B

main(){ int a,b; a=0; b=(a=1)?2:3; printf("%d %d",a,b); }

  1. 1 3

  2. 1 2

  3. 0 3

  4. Compile Error


Correct Option: B

struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main(){ struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1; def.prev=&abc; def.next=&ghi; ghi.i=2; ghi.prev=&def; ghi.next=&jkl; jkl.i=3; jkl.prev=&ghi; jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

  1. 1

  2. 2

  3. 3

  4. nullpointer assignment


Correct Option: B

abc(){ _AX = 1000;} main(){ int i; i = abc(); printf("%d",i); }

  1. 1000

  2. garbage value

  3. undefined symbol _AX

  4. none of these


Correct Option: A

AI Explanation

To understand the correct answer, let's analyze the code step by step:

  1. The code defines a function named abc() which takes no arguments.
  2. Inside the abc() function, the value of the _AX variable is set to 1000.
  3. The main() function is defined.
  4. Inside the main() function, an integer variable i is declared.
  5. The i variable is assigned the return value of the abc() function.
  6. The printf() function is used to print the value of i using the format specifier %d.

Now, let's go through the options to determine the correct answer:

A) 1000 - This option is correct. The abc() function sets the value of _AX to 1000, and this value is assigned to the variable i in the main() function. Therefore, when the printf() function is called, it prints the value of i, which is 1000.

B) garbage value - This option is incorrect. The value assigned to i is not a garbage value. It is a valid value that was explicitly set in the abc() function.

C) undefined symbol _AX - This option is incorrect. The _AX symbol is defined in the code, and its value is set to 1000 in the abc() function. Therefore, it is not an undefined symbol.

D) none of these - This option is incorrect. As explained above, option A is the correct answer.

Therefore, the correct answer is A) 1000.

What is the output of the following? int main() { ... int *p=new int(87); ... }

  1. compile time error

  2. run time error

  3. p is initialized to 87

  4. space for an array of 87 integers is allocated


Correct Option: C

The cast operator used for casting inherently incompatible pointer types

  1. reinterpret_cast

  2. static_cast

  3. dynamic_cast

  4. const_cast


Correct Option: A

When a virtual function is inherited, its virtual nature is also inherited.

  1. True

  2. False


Correct Option: A
  1. PROCEDURE DIVISION, DATA DIVISION, ENVIRONMENT DIVISION

  2. PROCEDURE DIVISION, FILE-CONTROL, INPUT-OUTPUT

  3. ENVIRONMENT DIVISION, IDENTIFICATION DIVISION, WORKING-STORAGE SECTION

  4. WORKING-STORAGE SECTION, DATA DIVISION, FILE SECTION


Correct Option: A

WHICH OF THE FOLLOWING WAS NOT THE APPROVER OF COBOL STANDARDS?

  1. ANSI

  2. USASI

  3. ASI

  4. CODASYL


Correct Option: D

WHICH OF THE FOLLOWING IS THE FIRST ISO APPROVED VERSION OF COBOL?

  1. COBOL-68

  2. COBOL-74

  3. COBOL-85

  4. COBOL-9x


Correct Option: A

FROM WHICH OF THE FOLLOWING EARLIER LANGUAGES, THE USE OF PICTURE CLASS HAS BEEN BORROWED INTO COBOL?

  1. FORTRAN

  2. COMPTRAN

  3. FLOW MATIC

  4. PASCAL


Correct Option: B

WHAT WAS THE EARLY NAME OF COBOL AS NAMED BY CODASYL COMMITTEE?

  1. Common Business Oriented Language

  2. Common Business Language

  3. Business Oriented Language

  4. Business Language


Correct Option: B

WHEN WAS THE FIRST VERSION OF COBOL RELEASED?

  1. 1958

  2. 1960

  3. 1968

  4. 1975


Correct Option: A

WHICH OF THE FOLLOWING COMMITTEES WERE MERGED AFTER THE RELEASE OF COBOL-85 TO FORM THE NOW-EXISTING COBOL STANDARDIZATION COMMITTEE(J4)?

  1. CODASYL AND X3J4

  2. CODASYL AND X3

  3. CODASYL AND CCC

  4. CCC AND X3J1


Correct Option: A
- Hide questions