Programming Languages Quiz

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/31

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

32 Terms

1
New cards

Question 1: Which of the following is a primary goal of a programming language?

·          - To provide a simple syntax

·          - To facilitate communication between the programmer and the computer

·          - To execute the program faster

·          - To support multiple hardware platforms

·          - None of these

To facilitate communication between the programmer and the computer

2
New cards

Question 2: Which of the following is an example of a low-level programming language?

·          - Python

·          - Java

·          - C++

·          - Assembly language

Question 2: Assembly language

3
New cards

Question 3: What is the role of a compiler in programming languages?

·          - To execute the program

·          - To translate source code into machine code

·          - To check for syntax errors

·          - To provide an interactive environment for the programmer

Question 3: To translate source code into machine code

4
New cards

Question 4: Which of the following is NOT a feature of high-level programming languages?

·          - Machine independence

·          - Easy readability

·          - Direct manipulation of hardware

·          - Automatic memory management

Question 4: Direct manipulation of hardware

5
New cards

Question 5: Which of the following is a feature of a structured programming language?

·          - Use of goto statements

·          - Use of function calls and loops to organize code

·          - Direct memory manipulation

·          - Use of object classes

Question 5: Use of function calls and loops to organize code

6
New cards

Question 6: Which characteristic distinguishes a compiled language from an interpreted language?

·          - Compiled languages require an interpreter to run.

·          - Interpreted languages translate code into machine code before execution.

·          - Compiled languages translate source code into machine code before execution.

·          - There is no difference between compiled and interpreted languages.

Question 6: Compiled languages translate source code into machine code before execution.

7
New cards

Question 7: Which of the following is an advantage of a language like Java, which is compiled into bytecode and then interpreted by a virtual machine?

·          - It runs faster than native compiled languages.

·          - It is more portable across different operating systems.

·          - It requires less memory than native compiled languages.

·          - It simplifies debugging by eliminating runtime errors.

Question 7: It is more portable across different operating systems.

8
New cards

Question 8: Which of the following is an example of a declarative programming language?

·          - SQL

·          - C++

·          - Java

·          - Fortran

Question 8: SQL

9
New cards

Question 9: Which of these is a feature of functional programming languages?

·          - Emphasis on the use of objects

·          - Focus on statements that change program state

·          - Programs are built around functions that transform data

·          - Direct interaction with hardware

Question 9: Programs are built around functions that transform data

10
New cards

Question 10: In the context of programming languages, what does 'syntax' refer to?

·          - The meaning of various constructs in the language

·          - The rules that define the structure of valid statements

·          - The memory management techniques

·          - The ability of the language to support multiple platforms

Question 10: The rules that define the structure of valid statements

11
New cards

Question 11: The Von Neumann Architecture is based on the concept of a 'stored-program' where both instructions and data are stored in the same memory.

·          - True

·          - False

Question 11: True

12
New cards

Question 12: In a typical computer, the data and instructions are stored in the same memory, which leads to the problem of:

·          - Data corruption

·          - Memory fragmentation

·          - The Von Neumann bottleneck

·          - Data overflow

Question 12: The Von Neumann bottleneck

13
New cards

Question 13: Choose ALL strings that can be generated by 10*

·          - 10

·          - Empty String

·          - 1010

·          - 100

·          - 100000

Question 13: 10, 100, 100000

14
New cards

Question 14: Regular Expressions are used to generate / verify lexemes

·          - True

·          - False

Question 14: True

15
New cards

Question 15: (1|0)* is same as (0|1)*

·          - True

·          - False

Question 15: True

16
New cards

Question 16: Choose ALL strings that can be generated by both ab* and (ab)*

·          - Empty String

·          - abb

·          - a

·          - ab

·          - abab

·          - None of these

Question 16: ab

17
New cards

Question 17: Empty string can be generated by a|b*

·          - True

·          - False

Question 17: True

18
New cards

Question 18: Two distinct strings with 2 alphabets can be generated by a|b*.

·          - True

·          - False

Question 18: False

19
New cards

Question 19: Two distinct strings with 2 alphabets can be generated by ab|b*.

·          - True

·          - False

Question 19: True

20
New cards

Question 20: The strings generated by ab|b* can be described as 'a followed by one or more b'

·          - True

·          - False

Question 20: False

21
New cards

Question 21: 'ab' can be generated by both ab* and (ab)*

·          - True

·          - False

Question 21: True

22
New cards

Question 22: The regular expression a(a|b)+ | b(a|b)+ is equivalent to (a|b)*

·          - True

·          - False

Question 22: True

23
New cards

Question 23: What Token category does a variable 'average' belong to?

·          - Reserved word

·          - Identifier

·          - Literal or Constant

·          - Special Symbol

Question 23: Identifier

24
New cards

Question 24: What Token category does 'int' belong to?

·          - Reserved word

·          - Identifier

·          - Literal or Constant

·          - Special Symbol

Question 24: Reserved word

25
New cards

Question 25: What Token category does '23' belong to?

·          - Reserved word

·          - Identifier

·          - Literal or Constant

·          - Special Symbol

Question 25: Literal or Constant

26
New cards

Question 26: What Token category does 'hello world!' belong to?

·          - Reserved word

·          - Identifier

·          - Literal or Constant

·          - Special Symbol

Question 26: Literal or Constant

27
New cards

Question 27: What Token category does '++' belong to?

·          - Reserved word

·          - Identifier

·          - Literal or Constant

·          - Special Symbol

Question 27: Special Symbol

28
New cards

Question 28: In a BNF, a rule can have multiple RHS

·          - True

·          - False

Question 28: True

29
New cards

Question 29: Consider the following statement: 'int sum = n + 10 /* assignment statement */;'. Select all Lexemes:

·          - sum

·          - n

·          - ;

·          - /*

·          - assignment

Question 29: sum, n, ;

30
New cards

Question 30: Which Token category does 'sum' belong to?

·          - Identifier

·          - Constant

·          - Symbol

·          - Reserved Word

·          - None of these

Question 30: Identifier

31
New cards

Question 31: Which Token category does '->' belong to?

·          - Identifier

·          - Constant

·          - Symbol

·          - Reserved Word

·          - None of these

Question 31: None of these

32
New cards

Question 32: Which Token category does ';' belong to?

·          - Identifier

·          - Constant

·          - Symbol

·          - Reserved Word

·          - None of these

Question 32: Symbol