Tag: programming languages

Questions Related to programming languages

Given the following two classes, which statement is true? ---------- class-1 ---------- package pack; public class Parent { protected void test() { System.out.println("Test"); } } ---------- class-2 ---------- 1. package mypack; 2. import pack.*; 3. class ParentTest extends Parent{ 4. public static void main(String[] args){ 5. new ParentTest().test(); 6. new Parent().test(); 7. } 8. }

  1. The code will compile and run only if line 5 is removed.

  2. The code will compile and run only if line 6 is removed

  3. The code compiles and runs, printing "Test" twice

  4. The code compiles but throws an exception at runtime


Correct Option: B

000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOWORLD. 000300 000400* 000500 ENVIRONMENT DIVISION. 000600 CONFIGURATION SECTION. 000700 SOURCE-COMPUTER. RM-COBOL. 000800 OBJECT-COMPUTER. RM-COBOL. 000900 001000 DATA DIVISION. 001100 FILE SECTION. 001200 100000 PROCEDURE DIVISION. 100100 100200 MAIN-LOGIC SECTION. 100300 BEGIN. 100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS. 100500 DISPLAY "Hello world!" LINE 15 POSITION 10. 100600 STOP RUN. 100700 MAIN-LOGIC-EXIT. 100800 EXIT.

  1. COBOL

  2. LISP

  3. FORTRAN

  4. BASIC


Correct Option: A

AI Explanation

To answer this question, you need to identify the programming language used in the given code snippet.

The correct answer is A) COBOL. This option is correct because the code snippet uses the syntax and structure specific to COBOL programming language. The code contains COBOL-specific sections such as IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, and PROCEDURE DIVISION. Additionally, it includes COBOL-specific statements like DISPLAY and STOP RUN.

with Text_To; use Text_To procedure hello is begin put("Hello World"); end hello

  1. LISP

  2. PROLOG

  3. ADA

  4. BASIC


Correct Option: C

10 PRINT "Hello World!" 20 GOTO 10

  1. PYTHON

  2. Z

  3. CSP

  4. BASIC


Correct Option: D