141
83.2k

190+ Principles of Programming Languages Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Mechanical Engineering , Programming Languages .

51.

What will be the output of the following code?

#include <iostream.h>
using namespace std;
int main()
{
float a = 'a';
cout << a;
return 0;
}

A. a
B. 0.0
C. 97
D. syntax error
Answer» C. 97
52.

What will be the output of the following code?
int main()
{
char ch;
ch = 129;
printf("%d\n", ch);
return 0;
}

A. 129
B. -129
C. -127
D. syntax error
Answer» C. -127
53.

When the type conversion is required?

A. the value to be stored is in the form not supported by data type
B. the value supported is beyond the max limit
C. to reduce the memory in use associated with that value
D. all of these
Answer» D. all of these
54.

What is the output of the following code?
int main()
{
double x = 1.2;
int sum = (int) x + 1;
printf("sum=%d", sum);
return 0;
}

A. 2.2
B. 2
C. 2
D. conversion from double to int is not possible
Answer» B. 2
55.

#include <iostream>
using namespace std;
int main()
{
int a = 10, b = 20;
a = a++;
b = ++b;
cout << a << b;
return 0;
}

A. 10 20
B. 11 20
C. 10 21
D. 11 21
Answer» C. 10 21
56.

A strict type system in which one operand type A is allowed to perform operation with another operand with type B.This feature of type system is called _____________.

A. type compatibility
B. type equivalence
C. type conformance
D. all of these
Answer» D. all of these
57.

What is strong type system?

A. the type system in which only built-in data types are allowed.
B. the type system in which only user defined data types are allowed.
C. the type system that guarantees not to generate type errors.
D. none of these
Answer» C. the type system that guarantees not to generate type errors.
58.

chosse the incorrect statement

A. int a[]=new int[10]
B. int[] a=new int[10]
C. int a[]=int[10] new
D. all of these
Answer» C. int a[]=int[10] new
59.

which of the following is not data type in pascal?

A. real
B. float
C. double
D. struct
Answer» B. float
60.

during implicit conversion is it possible to

A. loss of information
B. sign can be lost
C. occure overlow
D. all of these
Answer» C. occure overlow
61.

For defining interface in java --------- keyword is used?

A. interface
B. interface
C. inter
D. class_interface
Answer» B. interface
62.

which of the not looping statement in c?

A. while
B. until
C. double
D. for
Answer» B. until
63.

following is posted loop?

A. do while
B. for
C. if
D. while
Answer» A. do while
64.

choose the correct?
I)procedure is a kind of routine that return a value?
II)functio is a kind of routine that dose no return any value?

A. only one
B. only two
C. both i&ii
D. none of these
Answer» D. none of these
65.

exception is throw using the keyword ?

A. thrown
B. throw
C. throws
D. throwing
Answer» B. throw
66.

which keyword is use to check exception?

A. thrown
B. try
C. catch
D. exception
Answer» C. catch
67.

exception handling is for….

A. handling run time error
B. handling syntax error
C. handling logical error
D. all of these
Answer» A. handling run time error
68.

FORTRAN uses______________.

A. static allocation strategy
B. stack allocation strategy
C. heap allocation strategy
D. none of these
Answer» A. static allocation strategy
69.

Execution time languages can be classified are__________.

A. static languages
B. stack-based languages
C. fully dynamic languages
D. all of these
Answer» D. all of these
70.

call by name parameter passing method is used in___________.

A. c
B. pascal
C. algol
D. none of these
Answer» C. algol
71.

copy restore parameter passing method is used in___________.

A. c
B. pascal
C. ada
D. none of these
Answer» C. ada
72.

Grammars are capable to describe the structure of ........and independent ........models.

A. language and computational
B. language and lexical
C. language and syntactic
D. none of above.
Answer» A. language and computational
73.

The language syntax is characterized by two arrangements of rules: ....... and.........

A. logical and syantax
B. lexical and syntactic
C. lexical and symmetric
D. none of these
Answer» B. lexical and syntactic
74.

The distinctin among ......and......standards is to same degree Subjective.

A. logical and syantax
B. lexical and symmetric
C. lexical and syntactic
D. none of these
Answer» C. lexical and syntactic
75.

........give another method for characterizing structure of Programming language.

A. syntax diagrams.
B. axiomatic and denotational approach.
C. context free grammar
D. all of these.
Answer» A. syntax diagrams.
76.

Representation of Non-terminals is done by.... and....by boxes.

A. circles and terminate
B. line and terminate
C. circle and terminal
D. line and terminal
Answer» C. circle and terminal
77.

The non-terminals symbol is defined with a transition diagram having......................

A. one entry and two exit edge
B. two entry and one exit edge
C. one entry and one exit edge
D. one entry and no exit edge
Answer» C. one entry and one exit edge
78.

.........tell what is processed by giving a numerical question (function) which is the significance of the program.

A. algebraic semantics.
B. denotational semantics.
C. operational semantics.
D. axiomatic semantics.
Answer» B. denotational semantics.
79.

.....semantics are utilized when taking in a programming language and by compiler journalists.

A. algebraic semantics.
B. denotational semantics.
C. operational semantics.
D. axiomatic semantics.
Answer» C. operational semantics.
80.

Translation semantics are used in.......

A. interpreters
B. compilers
C. errors.
D. both a and b
Answer» B. compilers
81.

A program is viewed as a state machine by...........

A. algebraic semantics.
B. denotational semantics.
C. operational semantics.
D. axiomatic semantics.
Answer» D. axiomatic semantics.
82.

In a compiler.....checks every character of the source text.

A. the lexical analyzer.
B. the syntax analyzer.
C. the code generator.
D. the code optimizer.
Answer» A. the lexical analyzer.
83.

..... Syntax can only represent a rule in one line, whereas in.....a terminating character, the semicolon, marks and end of a rule.

A. ebnf, bnf
B. bnf,ebnf
C. all of above
D. none of these
Answer» B. bnf,ebnf
84.

The full form of EBNF....

A. extended backus naur form
B. extended beginning normal form
C. extended best normal form
D. none of above
Answer» A. extended backus naur form
85.

The syntax of language id define by two sets…

A. lexical rules
B. syntactic rules
C. both a & b
D. none of this
Answer» C. both a & b
86.

Syntax of ALGOL 60 was defined with

A. simply stating some rules in english
B. context-free grammar
C. simple language
D. no syntax
Answer» B. context-free grammar
87.

Meta-language is

A. used to described other language
B. simple language
C. instruction set
D. none of this
Answer» A. used to described other language
88.

EBNF is metalanguage

A. true
B. false
Answer» A. true
89.

Postcondition is

A. predicate p required to hold after execution of statement s
B. predicate q such that execution of s terminates & p holds upon termination
C. either a or b
D. both true
Answer» A. predicate p required to hold after execution of statement s
90.

Predicate Q can be return as

A. q=t and r;t=termination,r=truth of p
B. r=i
C. q=t
D. q=r
Answer» A. q=t and r;t=termination,r=truth of p
91.

Predicate W is called as

A. weakest precondition
B. weakest postcondition
C. both a & b
D. none of this
Answer» A. weakest precondition
92.

Axiomatic semantics specifies each statement of a language in terms of asemis

A. predicate translation
B. predicate transformer
C. predicate q
D. none of this
Answer» B. predicate transformer
93.

Function mem from the set of program identifiers ID to values

A. condition
B. predicate
C. function
D. state
Answer» D. state
94.

I is invariant predicate that satisfies condtion

A. i and b subset of asem (l,i)
B. i and not b subset of p
C. both a and b
D. none of above
Answer» C. both a and b
95.

Which of the following is true about implicit cursor?

A. implicit cursor are used for sql that are not named
B. developers should use implicit cursors with great care
C. implicit cursors are no longer a feature in oracle
D. none of above
Answer» A. implicit cursor are used for sql that are not named
96.

Which of the following is not a feature of a cursor FOR loop

A. record type declaration
B. opening and parsing of sql statement
C. fetches records from cursor
D. requires exit condition to be defined
Answer» B. opening and parsing of sql statement
97.

Which of the following are implicit cursor attributes?

A. %found
B. %too_many_rows
C. %notfound
D. %rowtype
Answer» C. %notfound
98.

In left out,which of the following would be cuase an infinite loop occure in a simple loop?

A. loop
B. end loop
C. if_then
D. exit
Answer» B. end loop
99.

Which of the following statement will produce an error?

A. cursor action_cursor is
B. select name,rate,action
C. into action_record
D. none of the above
Answer» C. into action_record
100.

The command used to open a CURSOR FOR loop is

A. open
B. fetch
C. parse
D. none of the above
Answer» D. none of the above

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.