Computer Science - Principles of Programming Languages
Quiz-summary
0 of 87 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
Information
This is MCQs of Computer Science Subject UNIX.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 87 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- Answered
- Review
-
Question 1 of 87
1. Question
If the postfix equivalent of the statement
if c then x else y is cxy#, then the postfix form amn+mn-ab-#ba-#Correct
Incorrect
-
Question 2 of 87
2. Question
A recursive function f , is defined as follows:
f (n) = 2, if n = 0
= m, if n = 1
= 2xf (n-1) + 4xf (n-2) , if n >= 2
if the value of f (f) is 88 then the value of m isCorrect
Incorrect
-
Question 3 of 87
3. Question
Consider the FORTRAN statement – DO5I = 1, 10
To recognize Do as a keyword, the compiler (lexical analyzer) has to scanCorrect
Incorrect
-
Question 4 of 87
4. Question
Use of recursion
Correct
Incorrect
-
Question 5 of 87
5. Question
A program has 100 instructions and another program (for the same problem) has 200
instructions. Which of the following comment logically follows?Correct
Incorrect
-
Question 6 of 87
6. Question
The conditional expansion facility of macro processors is provided to
Correct
Incorrect
-
Question 7 of 87
7. Question
Which of the following languages is case-sensitive (i.e., IF is not same as if)?
Correct
Incorrect
-
Question 8 of 87
8. Question
Val is a well known
Correct
Incorrect
-
Question 9 of 87
9. Question
Consider the following pseudo-Pascal function
function fibo (n : integer) : integer ;
begin
if (n = 0) then fibo := 0
else if (n = 1) then fibo := 1
else fibo := fibo (n-1) + fibo (n-2)
end
If fibo (5) is the function call, fibo (1) will be usedCorrect
Incorrect
-
Question 10 of 87
10. Question
An ordinary calculator treats all operators
Correct
Incorrect
-
Question 11 of 87
11. Question
In which of the following parameter passing mechanism, the actual argument has to be a variable?
Correct
Incorrect
-
Question 12 of 87
12. Question
Which of the following class of statements usually produce no object code when compiled?
Correct
Incorrect
-
Question 13 of 87
13. Question
The principle that a function can always be replaced by its value (irrespective of the context, without changing the meaning is called
Correct
Incorrect
-
Question 14 of 87
14. Question
Programming languages offer features to write functions to
Correct
Incorrect
-
Question 15 of 87
15. Question
The following pseudo-Pascal procedure
Procedure palin ;
var c : char ;
begin
read (c) ;
if NOT eoln then palin ;
write (c) ;
end
can be used toCorrect
Incorrect
-
Question 16 of 87
16. Question
In a certain language, the expression 5-3+2 x 4+1, evaluates to 0. Which of the following conclusions about the precedence and associativity of the operators +, -, * are correct ?
Correct
Incorrect
-
Question 17 of 87
17. Question
The output of the following pseudo-Pascal program is
var a : integer;
procedure p;
begin
a := 2; write (a)
end
begin
a := 1; p; write (a)
endCorrect
Incorrect
-
Question 18 of 87
18. Question
Which of the following comparisons between static and dynamic type checking is incroorect?
Correct
Incorrect
-
Question 19 of 87
19. Question
The period of time between an allocation and its subsequent disposal is called
Correct
Incorrect
-
Question 20 of 87
20. Question
Consider the following pseudo-Pascal program.
procedure A;
x,y : integer ;
procedure B;
x,z : real ;
statement 1
end B;
procedure C;
i : integer;
statement 2
end C;
end A;
The variables accessible in statement 1 and statement 2 areCorrect
Incorrect
-
Question 21 of 87
21. Question
Consider the following sequence of statements
statement 1: A := B+c
statement 2: D := A+c
statement 3: E := A+B
statement 4: G := D+E
statement 5: H := E+A
statement 6: I := H+G
which of the statements can be executed in parallel ?Correct
Incorrect
-
Question 22 of 87
22. Question
If instruction are executed in parallel, whenever the required operands are available, then the execution time of the previous problem is logically same as that of sequentially executing
Correct
Incorrect
-
Question 23 of 87
23. Question
Aliasing is a situation where
Correct
Incorrect
-
Question 24 of 87
24. Question
Consider the following variant record declaration in pseudo-Pascal.
type abc = record
x : integer ;
case y : integer of
1 : (m : integer, n : real);
2 : (e, f : integer) ;
end
suppose a program uses an array of ‘p’ such records. Integer need 2 bytes of storage and real r bytes. If the array occupies 480 bytes, the value of p will beCorrect
Incorrect
-
Question 25 of 87
25. Question
A recursive function f (x) , is defined as follows:
if (x>100)
return (x-10)
else return (f(f(x+11)))
For which of the following values of x, f(x) = 91?Correct
Incorrect
-
Question 26 of 87
26. Question
English language uses full stop as a sentence
Correct
Incorrect
-
Question 27 of 87
27. Question
In a hypothetical language, all operators have equal precedence and associate to the left, In this language, the expression 5 x 3 – 2 – 1 x 2 evaluates to
Correct
Incorrect
-
Question 28 of 87
28. Question
Overloading is
Correct
Incorrect
-
Question 29 of 87
29. Question
You are asked to use a computer to solve a problem given to you. How fast the computer solves your problem, depends on the
Correct
Incorrect
-
Question 30 of 87
30. Question
Which of the following is a dangling reference ?
Correct
Incorrect
-
Question 31 of 87
31. Question
Heap allocation is required for languages that
Correct
Incorrect
-
Question 32 of 87
32. Question
Jensen’s device makes explicit use of the property of
Correct
Incorrect
-
Question 33 of 87
33. Question
For which of the following applications will you prefer a co-routine to a subroutine?
Correct
Incorrect
-
Question 34 of 87
34. Question
Binding (of an identifier to a value) can occur while
Correct
Incorrect
-
Question 35 of 87
35. Question
COMMON feature of FORTRAN is not found in most of the languages that followed it because
Correct
Incorrect
-
Question 36 of 87
36. Question
Consider the following program fragment
procedure exchange (A: integer, B: integer)
temp : integer;
begin
temp := A; A := B; B := temp
end;
begin
M := 2; X[M]); write (M, x[2]);
end
If the parameters are passed by value, the output will beCorrect
Incorrect
-
Question 37 of 87
37. Question
4, 2 will be the output of the previous question if the parameters are passed by
Correct
Incorrect
-
Question 38 of 87
38. Question
If the parameters are passed by name, the output will be
Correct
Incorrect
-
Question 39 of 87
39. Question
Choose the correct remarks that are based on the following pseudo-Pascal function.
function doit (x, y : integer): integer;
begin
if(x = 0) then doit := y
else if (y = 0) then doit := x
else doit := doit (x-1, y-1)
endCorrect
Incorrect
-
Question 40 of 87
40. Question
Which of the following can be correctly identified to be Pascal tokens without look-ahead scanning?
Correct
Incorrect
-
Question 41 of 87
41. Question
Consider the following pseudo-Pascal program (assume(*starts a comment and*) ends a comment)
procedure doit (A, B, C) : integer;
begin
B := B-2; C := A+c (*; write (A)
end
If this program prints 16, then A, B, C should have been declared asCorrect
Incorrect
-
Question 42 of 87
42. Question
If the comment is removed in the previous in the previous problem, it will print 18,8, if the parameter declaration is
Correct
Incorrect
-
Question 43 of 87
43. Question
The vernacular language English can’t be used as a Computer Programming language because.
Correct
Incorrect
-
Question 44 of 87
44. Question
Choose the correct statements.
Correct
Incorrect
-
Question 45 of 87
45. Question
Binding cannot be done
Correct
Incorrect
-
Question 46 of 87
46. Question
The target of an assignment statement should be
Correct
Incorrect
-
Question 47 of 87
47. Question
Which of the following problem are iterative, rather than recursive in nature?
Correct
Incorrect
-
Question 48 of 87
48. Question
BNF is a meta-language for
Correct
Incorrect
-
Question 49 of 87
49. Question
The basic difference between a procedural language and an applicative language is that the
Correct
Incorrect
-
Question 50 of 87
50. Question
The output of the following Pascal program is
program x;
var char, real : integer;
false : boolean:
begin
char := 1; real := char; false := (char = real);
if (false = ture) then writeln (‘Don’t Worry’)
else writeln (‘Be Happy’)
endCorrect
Incorrect
-
Question 51 of 87
51. Question
This language is as powerful as
Correct
Incorrect
-
Question 52 of 87
52. Question
One of the four instructions is not needed That is
Correct
Incorrect
-
Question 53 of 87
53. Question
The program
clr C; clr B;
while (A not 0)
do
inc C; dec A;)
end;
while (C not 0)
do
inc A; inc B; dec C;
endCorrect
Incorrect
-
Question 54 of 87
54. Question
The program
clr C;
while A not 0
do
clr x;
while (B not 0)
do
inc C; inc x; inc B;
end;
while (x not 0)
do
inc B; dec x;
end;
dec A;
endCorrect
Incorrect
-
Question 55 of 87
55. Question
If we add one more instruction cpy x, y – which copies the contents of x to y, then the following program,
clr C; cpy A, x;
while(x not 0)
do
cpy x, y;
while (y not 0)
do
inc C; dec Y;
end;
dec x;
endCorrect
Incorrect
-
Question 56 of 87
56. Question
The following program
cpy A, x; clr C;
while (x not 0)
do
inv C; dec x;
endCorrect
Incorrect
-
Question 57 of 87
57. Question
The following program
cpy A, x;
while (x not 0)
do
inv M; clr x;
end;
cpy A, x; inv x;
while(x not 0)
do
inc M; clr x;
endCorrect
Incorrect
-
Question 58 of 87
58. Question
In which of the following cases, is it possible to obtain different results for call-by-reference and call-bu-name parameter passing?
Correct
Incorrect
-
Question 59 of 87
59. Question
If the language uses static scope rules, the output will be
Correct
Incorrect
-
Question 60 of 87
60. Question
If the language uses dynamic scope rules, the output will be
Correct
Incorrect
-
Question 61 of 87
61. Question
What will the following function compute?
function what (x, n : integer) : integer ;
var
value : integer;
begin
value := 1;
if (n > 0) then
begin
if (n mod 2 = 1) then
value := value*x;
value := value*what (x*x, n div 2);
end;
what := value;
end;Correct
Incorrect
-
Question 62 of 87
62. Question
An array A consists of n integers in locations A[0]m A[1]m . . . A[n-1]. It is a required to shift the elements of the array cyclically to the let by k places, where 1 ≤ k ≤ n – 1 . An incomplete algorithm for doing this is linear time, without using another array is given below. Complete the algorithm by filling in the blanks. Assume all variables are suitably declared.
min := n; i := 0;
while (_______) do
begin
temp := A [i] ; j ;= i;
while (_______) do
begin
A[j] := ______; j := (j+k) mod n;
if (j < min) then min := j; end; A[(n+i-k) mod n] := ________; i := _________; end;Correct
Incorrect
-
Question 63 of 87
63. Question
If static scoping is used by all variable, the output will be
Correct
Incorrect
-
Question 64 of 87
64. Question
If dynamic scoping is used by all variable, the output will be
Correct
Incorrect
-
Question 65 of 87
65. Question
Consider the recursive function
function fib(n : integer) : integer;
begin
if (n = 0) or (n = 1) then fib := 1
else fib := fib(n-1) + fib (n-2)
end;
The function is run on a computer with a stack of size 64 bytes. If only the return address and parameter are passed to the stack and they need two bytes each, estimate the maximum value of n for which the stack does not overflow.Correct
Incorrect
-
Question 66 of 87
66. Question
FORTRAN does not permit recursion because
Correct
Incorrect
-
Question 67 of 87
67. Question
A data driven machine is one that executes an instruction if the needed data is available. The physical ordering of the code listing does not dictate the course of execution. Consider the following pseudo-code.
(A) Multiply E by 0.5 to get F (B) Add A and B to get E
(C) Add B with 0.5 to get D (D) Add E and F to get G
(E) Add A with 10.5 to get C
Assume, A, B, C are already assigned values and the desired output is G.
Which of the following sequence of execution is valid?Correct
Incorrect
-
Question 68 of 87
68. Question
In the previous question in how many different ways can the 5 instructions be sequenced ?
Correct
Incorrect
-
Question 69 of 87
69. Question
In a demand-driven machine, an instruction is not execued until its output is needed.For the previous question, in what order will the instructions be sequenced ?
Correct
Incorrect
-
Question 70 of 87
70. Question
Choose the correct statements.
Correct
Incorrect
-
Question 71 of 87
71. Question
The following is an incomplete pseudo-Pascal function to convert a given decimal integer (in the range -8 to 7) into a binary integer in 2’s complement form. Determine the expressions that complete the program.
function TWOCOMP (N : integer) : Integer;
var
REM, EXPO, BINARY : integer ;
begin
if(n ≥ – 8) and (N ≤ 7) then
begin
if N N 0 then
N := . . . ;
BINARY := 0; EXPO := 1;
while N <> do
begin
REM := N mod 2;
BINARY := BINARY + . . . * EXPO;
EXPO := EXPO*10;
N := . . . ;
end;
TWOCOMP := BINARY
end
end;Correct
Incorrect
-
Question 72 of 87
72. Question
In the following pseudo-pascal program segment, the Value x, after the execution of the program is
X := -10 ;
Y := 20 ;
if X>Y
then
if X<0
then X := abs (X)
else X := 2*x;Correct
Incorrect
-
Question 73 of 87
73. Question
Consider the following macro definition.
macro Add x, y
Load y
Mul x
Store y
end macro
x and y areCorrect
Incorrect
-
Question 74 of 87
74. Question
Which of the following strings can definitely be said to be tokens without looking at the next input character while compiling a pascal program
I, begin II, program III. <>Correct
Incorrect
-
Question 75 of 87
75. Question
Assume X and y are non-zero positive integers. The following pseudo-Pascal program
while x <> y do
if X > y then x := x-y
else y := y-x :
write (X) ;Correct
Incorrect
-
Question 76 of 87
76. Question
The value of x printed by the following pseudo-Pascal program is
program COMPUTE (input, output) ;
var
X : integer ;
Procedure FIND (X : real) ;
begin
X := sqrt (X) ;
end;
begin
X := 2 ; FIND(X) ; writeln (X)
end.Correct
Incorrect
-
Question 77 of 87
77. Question
A language with string manipulation facilities uses the following operations.
head (s) – returns the first character of string S.
tail (s) – returns all but the first character of string S.
concat (s1, s2) concat (head (s) , head (tail (tail (s)))) , where s is acbc, isCorrect
Incorrect
-
Question 78 of 87
78. Question
Which of the following statements are true?
I. AS the number of entries in the hash table increases, the number of collisions increases.
II. Recursive programs are efficient.
III. The worst case complexity of Quick sort is O (n2
)
IV. Binary search using a linear linked list is efficient.Correct
Incorrect
-
Question 79 of 87
79. Question
Consider the following high level program segment.
var
A, B, W, X, Y : unsigned byte;
begin
x := A+B;
Y := abs(A-B) ;
W := A-B;
Z := A*B;
end
Assuming integer occupies 2 bytes and the initial values of A and B are 5CH and 92H respectively, the final values of W, X, Y and Z will beCorrect
Incorrect
-
Question 80 of 87
80. Question
Consider the following pseudo-Pascal function, where A and B are non-zero positive integers. What is the value of GET (3,2)?
function GET (A, B : integer) : integer;
begin
if B = 0
then
GET := 1
else if A < B then GET := 0 else GET := GET (A-1,B) + GET (A-1,B-1) end;Correct
Incorrect
-
Question 81 of 87
81. Question
A variant record in Pascal is defined as
type varirec = record
number: integer;
case (varl, Var2) of
Var1 : (x, y : integer) ;
Var2 : (p, q : real)
end
end
suppose an arry of 100 such records was declared on a machine, which uses 4 bytes for an integer and 8 bytes for a real. How much space would the compiler have to reserve for the array?Correct
Incorrect
-
Question 82 of 87
82. Question
Consider the assignment statement
var1 = var1 + var2 ;
The sequence of notations that correctly reflects the usage of the variable var1 isCorrect
Incorrect
-
Question 83 of 87
83. Question
Which of the following sequences (for a particular variable) is harmless but suspicious?
Correct
Incorrect
-
Question 84 of 87
84. Question
Which of the following sequence (for a particular variable) are probably bugs?
Correct
Incorrect
-
Question 85 of 87
85. Question
In addition to the above notations let us use the notation-X, where X is one of D, K or U, to mean that nothing of interest (concerning the variable under consideration ) happened to the variable. Which of the following situations are probably anomalous?
Correct
Incorrect
-
Question 86 of 87
86. Question
Vernacular languages (like English) and programming languages have a lot of similarities. In a broad sense, the nouns and verbs are comparable to
Correct
Incorrect
-
Question 87 of 87
87. Question
Consider the following C program.
#include “stdio.h”
main ( )
{
enum boolean {true, false};
enum boolean a, b, c;
a = b = true;
c (a==b);
if (c == a)
printf (“TRUE”);
else
printf (“FALSE”);
}
The output of the above program will beCorrect
Incorrect