Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Chapter: 11
Q161:
What will be the output of the REPLACE function if TEXT = "A(I,J) = A(I,J) + 3"?
A. A(I,J) = A(I,J) + 3
B. A<I,J> = A<I,J> + 3
C. A(I,J) = A(I,J) + <>
D. A<I,J> = A<I,J> + <>
Correct Answer: B
Chapter: 11
Q162:
In SNOBOL, what data type can an array hold?
A. Only strings
B. Only integers
C. Multiple data types
D. Only floating point numbers
Correct Answer: C
Chapter: 11
Q163:
What is the result of the statement "V = ARRAY(10, 1.0)" in SNOBOL?
A. Creates an empty array
B. Creates a 1-dimensional array of 10 elements with 1.0 as initial value
C. Creates a 2-dimensional array
D. Initializes an array with random values
Correct Answer: B
Chapter: 11
Q164:
Which of the following best describes the use of the unary operator '$' in SNOBOL?
A. It performs a calculation
B. It references a memory address
C. It assigns a variable value
D. It uses a variable as the name of another variable
Correct Answer: D
Chapter: 11
Q165:
What happens when an array index exceeds the defined range in SNOBOL?
A. An error occurs
B. The array index is reset to 0
C. The program stops execution
D. The control jumps to a label
Correct Answer: A
Chapter: 11
Q166:
What does the command "N = ARRAY('3,5')" do in SNOBOL?
A. Creates a 3x5 matrix
B. Creates a 3-dimensional array
C. Creates a 2x5 array initialized to NULL
D. Creates a 1-dimensional array
Correct Answer: C
Chapter: 11
Q167:
What type of functions does SNOBOL 4 support?
A. Built-in functions only
B. User-defined functions only
C. Both built-in and user-defined functions
D. No functions are supported
Correct Answer: C
Chapter: 11
Q168:
What is the output of the following code: "RUN = 10; WORD = 'RUN'; $(WORD) = $(WORD) + 1"?
A. RUN = 11
B. WORD = 11
C. RUN = RUN + 1
D. WORD = 'RUN+1'
Correct Answer: A
Chapter: 11
Q169:
How does SNOBOL handle arrays differently from most languages?
A. All elements must be of the same type
B. Each element can be of a different type
C. Arrays cannot be dynamically sized
D. Arrays are fixed in size
Correct Answer: B
Chapter: 11
Q170:
What does the ARRAY function in SNOBOL return?
A. A string
B. A number
C. An array with specified values
D. A pointer to the array
Correct Answer: C
Chapter: 11
Q171:
In SNOBOL, what will happen if an array index exceeds the array size during runtime?
A. The program will crash
B. Nothing will happen
C. The control will jump to a label
D. The array will be resized
Correct Answer: C
Chapter: 11
Q172:
What does the 'BREAK' function do in SNOBOL?
A. It breaks the execution loop
B. It marks the start of a string
C. It searches for a pattern in a string
D. It splits the string into words
Correct Answer: C
Chapter: 11
Q173:
What is the purpose of the SPAN function in SNOBOL?
A. It scans the subject for digits
B. It moves the cursor through a string
C. It checks for word length
D. It splits the string into segments
Correct Answer: B
Chapter: 11
Q174:
How does the program in SNOBOL count occurrences of words of lengths between 3 and 9?
A. It uses a fixed size array
B. It reads lines from input and stores word lengths
C. It creates an array and increments the value at each index
D. It calculates word length based on sentence structure
Correct Answer: C
Chapter: 12
Q175:
What does the "TABLE()" function create in SNOBOL?
A. A table with unspecified length
B. A predefined array
C. A record type object
D. A fixed-length array
Correct Answer: A
Chapter: 12
Q176:
In SNOBOL, which data structure is indexed by a key value rather than an index number?
A. Array
B. Table
C. Record
D. String
Correct Answer: B
Chapter: 12
Q177:
What does the operator "T<'A'> = 1" in SNOBOL do?
A. Associates 'A' with value 1
B. Creates an empty table
C. Adds 'A' to an array
D. Assigns value to a string
Correct Answer: A
Chapter: 12
Q178:
Which of the following is a feature of SNOBOL?
A. Static typing
B. Lack of string operations
C. Dynamic typing
D. Limited string operations
Correct Answer: C
Chapter: 12
Q179:
What is a limitation of SNOBOL mentioned in the content?
A. Lack of variable length strings
B. Complicated array syntax
C. Poor documentation
D. No operator overloading
Correct Answer: C
Chapter: 12
Q180:
SNOBOL allows mixing _______ operations with string operations.
A. Only string
B. Only arithmetic
C. Both arithmetic and string
D. Only boolean
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now