Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

Multiple choice question for engineering

Set 1

1. Which of the following correctly declares an array?
a) Int array[ 10]
b) int array
c) array{10}
d) array array[ 10]

View Answer

Answer: a [Reason:] Correct declaration.

2. What is the index number of the last element of an array with 29 elements?
a) 29
b) 28
c) 0
d) Programmer-Defined

View Answer

Answer: b [Reason:] The indexing in an array starts with zero hence we can say that the element

3. Which of the following is a two-dimensional array?
a) array array[20][20]
b) int array[20][20]
c) int array[20, 20]
d) char array[20]

View Answer

Answer: b [Reason:] Double dimensional arrays are declared in this format

4. Which of the following correctly accesses the seventh element stored in tan?
a) tan[6]
b) tan[7]
c) tan(7)
d) tan

View Answer

Answer: a [Reason:] The index no 6.

5. Which of the following gives the memory address of the first element in array tan?
a) tan[0]
b) tan
c) &tan
d) tan [1]

View Answer

Answer: b [Reason:] the base address of the array is given by its name.

6. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
a) The compiler would report an error
b) May stop working abruptly if data gets overwritten
c) None of the mentioned
d) The element will be set to 0

View Answer

Answer: b [Reason:] it often happens that the program crashes.

7. What does the following declaration mean? int (*a)[10] a is
a) Pointer to an array
b) None of the mentioned
c) Array of 10 integers
d) Both of the mentioned

View Answer

Answer: a [Reason:] points to array.

8. What is the meaning of following declaration?
Int arr[20]
a) Integer Array of size 20
b) None of the mentioned
c) Array of size 20
d) Array of size 20 that can have higher integer address

View Answer

Answer: a [Reason:] Declaration of an array

9. int a[20]
What will be the size of above array elements?
a) 21
b) 22
c) 20
d) 19

View Answer

Answer: c [Reason:] The number in square brackets denotes size of an array

10. What is meaning of the following?
Int *ptr[20]
a) Interger array of size 20 pointing to an integer Pointer
b) None of the mentioned
c) Array of integer pointer of size 20
d) Both of the mentioned

View Answer

Answer: c [Reason:] Array of pointers to integers

Set 2

1. In which way can SAM be stored in an array
a) char name[]=”SAM”
b) char name[6]={‘S’,’A’,’M’}
c) char name[6]={“S”,”A”,”M”}
d) char name [6]={‘S’,’A’,’M’,’ ’}

View Answer

Answer: d [Reason:] The array consists of the word SAM and also a NULL character.

2. Int RollNUm[30[4] is a
a) 1-d Array
b) 3-D Array
c) 4- D Array
d) 2-D Array

View Answer

Answer: d [Reason:] 2 [] brackets means a double dimensional array.

3. What will be output ?

#include<stdio.h>
void main()
{
    char arr[7]="Network";
    printf("%s",arr);
}

a) Network
b) N
c) network
d) Garbage Value

View Answer

Answer: d [Reason:] garbage value is printed

4. What will be output ?

#include<stdio.h>
void main()
{
char arr[11]="The African Queen";
printf("%s",arr);
}

a) The African Queen
b) The
c) Queen
d) Null

View Answer

Answer: d [Reason:] it gives a Null Value.

5. What will be output if you will execute following c code?

#include<stdio.h>
void main()
{
char arr[20]="MysticRiver";
printf("%d",sizeof(arr));
}

a) 20
b) 11
c) 30
d) None of the mentioned

View Answer

Answer: a [Reason:] The size of array is 20

6. What will be output if you will execute following c code?

#include<stdio.h>
void main(){
    int const SIZE=5;
    int expr;
    double value[SIZE]={2.0,4.0,6.0,8.0,10.0};
    expr=1|2|3|4;
    printf("%f",value[expr]);
}

a) 2.00000
b) 4.00000
c) 6.00000
d) Compilation error

View Answer

Answer: d [Reason:] No fixed value in [] brackets.

7. Comment on the following statement:

  int (*a)[7];

a) An array “a” of pointers.
b) A pointer “a” to an array.
c) A ragged array.
d) None of the mentioned

View Answer

Answer: b [Reason:] it is a pointer to array a

8. Comment on the 2 arrays regarding P and Q:

  int *a1[8];
    int *(a3[8]);
    P. Array of pointers
    Q. Pointer to an array

a) a1 is P, a2 is Q
b) a1 is P, a2 is P
c) a1 is Q, a2 is P
d) a1 is Q, a2 is Q

View Answer

Answer: b [Reason:] p =a1 And a3 is alo p

8. Which of the following is not possible statically in C?
a) Jagged Array
b) Rectangular Array
c) Cuboidal Array
d) Multidimensional Array

View Answer

Answer: a [Reason:] Jagged array is not possible.

9. What is the max no. of dimensions an array may have
a) 2
b) 8
c) 20
d) No limit

View Answer

Answer: d [Reason:] : Dimension of an array can be any number.

10. Array passed as an argument to a function is interpreted as
a) Address of the array
b) None of the mentioned
c) Base address
d) No. of elements of the array.

View Answer

Answer: c [Reason:] The base address is passed when the array is passed as an argument in a function.

Set 3

1. Inherited attribute is a natural choice in
a) Variable declarations record is maintained
b) L values and R values
c) All of the mentioned
d) None of the mentioned

View Answer

Answer: a [Reason:] It keeps track of variable.

2. YACC builds up
a) SLR parsing table
b) Canonical LR parsing table
c) LALR parsing table
d) None of the mentioned

View Answer

Answer: c [Reason:] It is a parser generator.

3. In an absolute loading scheme which loader function is accomplished by assembler
a) Re-allocation
b) Allocation
c) Linking
d) Loading

View Answer

Answer: a [Reason:] Large number variables onto a small number of CPU register.

4. A parser with the valid prefix property is advantageous because it
a) Detects errors
b) None
c) Errors are passed to the text phase
d) All of the mentioned

View Answer

Answer: c [Reason:] Advantage for a valid prefix property.

5. The action of parsing the source program into proper syntactic classes is called
a) Syntax Analysis
b) Lexical Analysis
c) Interpretation analysis
d) General Syntax Analysis

View Answer

Answer: b [Reason:] Conversion of characters to tokens.

6. Relocating bits used by relocating loader are specified by
a) Relocating loader itself
b) Linker
c) Assembler
d) Macro Processor

View Answer

Answer: b [Reason:] Takes an object files and combines them into a single executable file, library file, or another object file.

7. What is the binary equivalent of the decimal number 368
a) 10111000
b) 110110000
c) 111010000
d) 111100000

View Answer

Answer: b [Reason:] 368 binary equivalents is 8=1000 6=0110 3=0011 So 1101101000.

8. AB+(A+B)’ is equivalent to
a) A?B
b) A+B
c) (A+B)A
d) (A+B)B

View Answer

Answer: a [Reason:] It is equivalent to A? B.

9. A top down parser generates
a) Rightmost Derivation
b) Right most derivation in reverse
c) Left most derivation
d) Left most derivation in reverse

View Answer

Answer: c [Reason:] Top-down parsing is a parsing strategy where one first looks at the highest level of the parse tree and works down the parse tree by using the rewriting rules of a formal grammar.

10. Running time of a program depends on
a) Addressing mode
b) Order of computations
c) The usage of machine idioms
d) All of the mentioned

View Answer

Answer: d [Reason:] Run time, runtime or execution time is the time during which a program is running (executing).

Set 4

1. Which of the following is the fastest logic ?
a) TTL
b) ECL
c) CMOS
d) LSI

View Answer

Answer: b [Reason:] In electronics, emitter-coupled logic (ECL) is a high-speed integrated circuit.

2. A bottom up parser generates
a) Right most derivation
b) Rightmost derivation in reverse
c) Leftmost derivation
d) Leftmost derivation in reverse

View Answer

Answer: b [Reason:] This corresponds to starting at the leaves of the parse tree also known as shift-reduce parsing.

3. A grammar that produces more than one parse tree for some sentence is called
a) Ambiguous
b) Unambiguous
c) Regular
d) None of the mentioned

View Answer

Answer: a [Reason:] Ambiguous grammar has more than one parse tree.

4. An optimizer Compiler
a) Is optimized to occupy less space
b) Both of the mentioned
c) Optimize the code
d) None of the mentioned

View Answer

Answer: d [Reason:] In computing, an optimizing compiler is a compiler that tries to minimize or maximize some attributes of an executable computer program.

5. The linker
a) Is similar to interpreter
b) Uses source code as its input
c) I s required to create a load module
d) None of the mentioned

View Answer

Answer: c [Reason:] It is a program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another object file.

6. A latch is constructed using two cross coupled
a) AND OR gates
b) AND gates
c) NAND and NOR gates
d) NAND gates

View Answer

Answer: d [Reason:] It has two inputs and one output.

7. Pee Hole optimization
a) Loop Optimization
b) Local Optimization
c) Constant folding
d) Data Flow analysis

View Answer

Answer: a [Reason:] More loops are added.

8. The optimization which avoids test at every iteration is
a) Loop unrolling
b) Loop jamming
c) Constant folding
d) None of the mentioned

View Answer

Answer: a [Reason:] Execution speed is enhanced by sacrificing bits.

9. Scissoring enables
a) A part of data to be displayed
b) Entire data to be displayed
c) None of the mentioned
d) No data to be displayed

View Answer

Answer: a [Reason:] Displays only some part of the data.

10. Shift reduce parsers are
a) Top down Parser
b) Bottom Up parser
c) May be top down or bottom up
d) None of the mentioned

View Answer

Answer: b [Reason:] Also known as shift reduce parser.

Set 5

1. Inherited attribute is a natural choice in
a) Variable declarations record is maintained
b) L values and R values
c) All of the mentioned
d) None of the mentioned

View Answer

Answer: a [Reason:] It keeps track of variable.

2. YACC builds up
a) SLR parsing table
b) Canonical LR parsing table
c) LALR parsing table
d) None of the mentioned

View Answer

Answer: c [Reason:] It is a parser generator.

3. In an absolute loading scheme which loader function is accomplished by assembler?
a) Re-allocation
b) Allocation
c) Linking
d) Loading

View Answer

Answer: a [Reason:] Large number variables onto a small number of CPU register.

4. A parser with the valid prefix property is advantageous because it
a) Detects errors
b) None of the mentioned
c) Errors are passed to the text phase
d) All of the mentioned

View Answer

Answer: c [Reason:] Advantage for a valid prefix property.

5. The action of parsing the source program into proper syntactic classes is called
a) Syntax Analysis
b) Lexical Analysis
c) Interpretation analysis
d) General Syntax Analysis

View Answer

Answer: b [Reason:] Conversion of characters to tokens.

6. Relocating bits used by relocating loader are specified by
a) Relocating loader itself
b) Linker
c) Assembler
d) Macro Processor

View Answer

Answer: b [Reason:] Takes an object files and combines them into a single executable file, library file, or another object file.

7. What is the binary equivalent of the decimal number 368
a) 10111000
b) 110110000
c) 111010000
d) 111100000

View Answer

Answer: b [Reason:] 368 binary equivalents is 8=1000 6=0110 3=0011 So 1101101000.

8. AB+(A+B)’ is equivalent to
a) A?B
b) A+B
c) (A+B)A
d) (A+B)B

View Answer

Answer: a [Reason:] It is equivalent to A? B.

9. A top down parser generates
a) Rightmost Derivation
b) Right most derivation in reverse
c) Left most derivation
d) Left most derivation in reverse

View Answer

Answer: c [Reason:] Top-down parsing is a parsing strategy where one first looks at the highest level of the parse tree and works down the parse tree by using the rewriting rules of a formal grammar.

10. Running time of a program depends on
a) Addressing mode
b) Order of computations
c) The usage of machine idioms
d) All of the mentioned

View Answer

Answer: d [Reason:] Run time, runtime or execution time is the time during which a program is running (executing)