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. Suppose that a bus has 16 data lines and requires 4 cycles of 250 nests each to transfer data. The bandwidth of this bus would be 2 Megabytes/sec. If the cycle time of the bus was reduced to 125 nsecs and the number of cycles required for transfer stayed the same what would the bandwidth of the bus?
a) 1 Megabyte/sec
b) 4 Megabytes/sec
c) 8 Megabytes/sec
d) 2 Megabytes/sec

View Answer

Answer: D [Reason:] The bandwidth is 2 mb/s.

2. Floating point representation is used to store ______
a) Boolean values
b) Whole numbers
c) Real integers
d) Integers

View Answer

Answer: C [Reason:] They are real Integers.

3. SIMD represents an organization that ______________
a) Refers to a computer system capable of processing several programs at the same time
b) Represents organization of single computer containing a control unit, processor unit and a memory unit
c) Includes many processing units under the supervision of a common control unit
d) None of the mentioned

View Answer

Answer: C [Reason:] SIMD includes processing units under the super vision of a common control.

4. In Reverse Polish notation, expression A*B+C*D is written as
a) AB*CD*+
b) A*BCD*+
c) AB*CD+*
d) A*B*CD+

View Answer

Answer: A [Reason:] RPN is AB*CD*+.

5. _________ register keeps tracks of the instructions stored in program stored in memory.
a) AR (Address Register)
b) XR (Index Register)
c) PC (Program Counter)
d) AC (Accumulator)

View Answer

Answer: C [Reason:] program counter keeps a track.

6. A three input NOR gate gives logic high output only when_____
a) One input is high
b) One input is low
c) Two input are low
d) All input are high

View Answer

Answer: D [Reason:] All inputs are high.

7. The circuit converting binary data in to decimal is_____
a) Encoder
b) Multiplexer
c) Decoder
d) Code converter

View Answer

Answer: D [Reason:] It is the code converter.

8. The multiplicand register & multiplier register of a hardware circuit implementing booth’s algorithm have (11101) & (1100). The result shall be ______
a) (812)10
b) (-12)10
c) (12)10
d) (-812)10

View Answer

Answer: A [Reason:] On multiplying we get 81210.

9. PSW is saved in stack when there is a _____
a) Interrupt recognized
b) Execution of RST instruction
c) Execution of CALL instruction
d) All of the mentioned

View Answer

Answer: A [Reason:] It can be interrupted.

10. In computers, subtraction is carried out generally by____
a) 1’s complement method
b) 2’s complement method
c) signed magnitude method
d) BCD subtraction method

View Answer

Answer: B [Reason:] Subtraction done by 2’s complement.

Set 2

1. Select the output for following set of code.

 static void Main(string[] args)
  {int movie = 1;
      switch (movie << 2 + movie)
      {
      default: 
          Console.WriteLine("A");
          break;
      case 4: 
          Console.WriteLine("B");
          break;
      case 5: 
          Console.WriteLine("C");
          break;
      case 8: 
          Console.WriteLine("D");
          break;
      }
      Console.ReadLine();
  }

a) A
b) B
c) C
d) D

View Answer

Answer: c [Reason:] ‘default’ case can be put in anywhere. Output: D.

2. Select the output for following set of code :

 static void Main(string[] args)
  {int i = 2, j = 4;
      switch (i + j * 2)
      {
      case 1 :
      case 2 :
          Console.WriteLine("1 and 2");
          break;
      case 3 to 10:
          Console.WriteLine("3 to 10");
          break;
      }
      Console.ReadLine();
  }

a) 3 to 10 will be printed
b) 1 and 2 will be printed
c) error
d) The code gives output as 3 to 10

View Answer

Answer: c [Reason:] Output :

static void Main(string[] args)
{
int i = 2,j = 4;
switch (i + j * 2)
{
case 1 :
case 2 :
Console.WriteLine(1 and 2);
break;
case 3 :
Console.WriteLine(3 to 10);
break;
}
Console.ReadLine();
}

Here i = 2,j = 4.

3. Select the output for following set of code :

static void Main(string[] args)
 {
     int i = 2, k = 3;
     switch (i - k)
     {
     case -1:
         ++i;
         ++k;
         break;
     case 2:
         --i;
         ++k;
         break;
     default:
         i += 3;
         k += i;
         break;
     }
     Console.WriteLine(i + "n" + k);
     Console.ReadLine();
 }

a) 2 3 3
b) 3 2 3
c) 3 4 4
d) 5 10 10

View Answer

Answer: c Output: 3 4 4 [Reason:] i – k = -1.So, case -1 will be executed only .

4. Select output for following set of code :

static void Main(string[] args)
   {
       int const p = 0;
       switch (3 * 5 / 6)
       {
       case p: 
           Console.WriteLine("A");
           break;
       case p * 1:
           Console.WriteLine("B");
           break;
       case p - 2:
           Console.WriteLine("C");
           break;
       default: 
           Console.WriteLine("D");
       }
  }

a) A
b) B
c) C
d) Compile time error

View Answer

Answer: d [Reason:] No constant variable.

5. Select output for following set of code :

 static void Main(string[] args)
 {
     int i = 2, j = 3, k = 4;
     switch (i + j - k)
     {
     case 0: case 2: case 4:
         ++i;
         k += j;
         break;
     case 1: case 3: case 5 :
         --i;
         k -= j;
         break;
     default:
         i += j;
         break;
     }
     Console.WriteLine(i + "n" + j + "n" + k);
     Console.ReadLine();
 }

a) 1 3 1
b) 2 3 4
c) 5 3 4
d) Compile time error

View Answer

Answer: a [Reason:] Solving expression gives 1 Output : 1 3 1

6. Select the output for following set of code :

 static void Main(string[] args)
  {
      int  i = 9 , j = 7;
      switch (i - j + 3)
      {
      case 9: 7:
          j += 6;
          break;
      case 5:
          i -= 4;
          break;
      }
      Console.WriteLine(i + "n" + j);
      Console.ReadLine();
  }

a) 5 7
b) 9 13
c) Compile time error
d) 9 7

View Answer

Answer: c [Reason:] Invalid expression.

7. Select the output for code :

 static void Main(string[] args)
  {
      switch (5)
      {
      case 5.0f: 
          Console.WriteLine("harsh");
          break;
      case 5: 
          Console.WriteLine("amish");
          break;
      case 5.0L: 
          Console.WriteLine("ANKIT");
          break;
      default:
          Console.WriteLine("ashish");
      }
      Console.ReadLine();
   }

a) amish
b) ANKIT
c) harsh
d) Compile time error

View Answer

Answer: d [Reason:] Only integers are allowed . 5.0f = (int)5.0f. 5.0L =(int)5.0L.

8. Select output for code:

 static void Main(string[] args)
  {
      int i;
      int j = 1;
      int []ar = {21, 22, 13, 4};
      switch (ar[j])
      {
      case 1:
          i++;
          break;
      case 2:
          i += 2;
          j = 3;
          continue;
      case 3: 
         i %= 2;
         j = 4;
         continue;
      default: 
         --i;
      }
      Console.WriteLine(i);
      Console.ReadLine();
  }

a) 23
b) 15
c) Compile time error
d) 12

View Answer

Answer: c [Reason:] Continue cannot be used. Output :

static void Main(string[] args)
{
int i;
int j = 1;
int []ar = {21 , 22, 13, };
switch(ar[j])
{
case 1:
i++;
break;
case 2:
i += 2;
j = 3;
continue;
case 3:
i %= 2;
j = 4;
default:
–i;
}
Console.WriteLine(i);
Console.ReadLine();
}

9. Select the output for following set of Code:

 static void Main(string[] args)
 {
     char ch = Convert.ToChar('a' | 'b' | 'c');
     switch (ch)
     {
     case 'A':
     case 'a':
         Console.WriteLine("case A|case a");
         break;
     case 'B':
     case 'b':
         Console.WriteLine("case B|case b");
         break;
     case 'C':
     case 'c':
     case 'D':
     case 'd':
         Console.WriteLine("case D|case d");
         break;
     }
     Console.ReadLine();
 }

a) Compile time error
b) case A | case a
c) case B | case b
d) case D | case d

View Answer

Answer: d [Reason:] case D|case d

10. Select the output for following set of Code:

static void Main(string[] args)
  {
      char ch = 'p';
      switch (ch)
      {
      case 'p':
          Console.WriteLine("coco" + "t" + Convert.ToInt32(ch));
          break;
      default:
          Console.WriteLine("default");
          break; 
     }
     Console.WriteLine("main");
  }

a) coco main
b) coco 112
c) coco 112 main
d) compile time error

View Answer

Answer: c [Reason:] ASCII value of p is 112. Output: coco 112 main.

Set 3

1. How many times will the following loop be executed?

   ch = 'b';
while(ch >= 'a' && ch <= 'z')

a) 0
b) 25
c) 26
d) 1

View Answer

Answer: b [Reason:] Because there are 26 alphabets and so it runs for 26-1 times

2. Consider the following program

 switch(input)
{
    case '1':
        printf("One");
    case '2':
        printf("Two");
    case '3':
        printf(""Three");
    default:
        Printf("Default");
        break;
}

What will be printed when input is 2?
a) Two Three default
b) Two
c) Two default
d) Two Two default

View Answer

Answer: a [Reason:] Because in between cases there is no break statement

3. The advantage of ‘switch’ statement over ‘if’ is that it leads to more structured program.
a) True
b) False

View Answer

Answer: a [Reason:] switch is more convenient to use as it avoids confusion in case of more nested structure

4. Consider the following C program

 #include<stdio.h>
int main()
{
    int a=7, b=5;
    switch(a = a % b)
    {
        case 1:
            a = a - b;
        case 2:
            a = a + b;
        case 3:
            a = a * b;
        case 4:
            a = a / b;
        default:
            a = a;
    }
return 0;
}

Value of a?
a) 7
b) 5
c) Both of the mentioned
d) None of the mentioned

View Answer

Answer: a [Reason:] Initially a=a%b gives 2.then in case 2 a=a+b gives 2+5=7 .hence a=7

5. The statement for(;;) is perfectly valid C statement
a) True
b) False

View Answer

Answer: b [Reason:] Infinite loop

6. void main()

 {
    static a,b;
    while(a > b++)
}

What is the output?
a) a=0 b=0
b) a=0 b=0
c) a=1 b=1
d) None of the mentioned

View Answer

Answer: a [Reason:] Static variables have an initial value 0

7. for(digit = 0;digit < 9; digit++)

 {
    digit = digit *2;
    digit--;
}

No . of times the loop will run.
a) Infinite
b) 9
c) 0
d) 4

View Answer

Answer: a [Reason:] Infinite times it runs.

8. An if statement may contain compound statements only in the else clause
a) True
b) False

View Answer

Answer: b [Reason:] If can also have compound statements

9. A ‘while’ loop may always be converted to an equivalent ‘for’ loop
a) True
b) False

View Answer

Answer: a [Reason:] Can be converted to for loop

10. Default’ case is mandatory in a switch statement
a) True
b) False

View Answer

Answer: b [Reason:] Default cases may or may not be written.

Set 4

1. Which phase of compiler is Syntax Analysis
a) First
b) Second
c) Third
d) None of the mentioned

View Answer

Answer: b [Reason:] It is Second Phase Of Compiler after Lexical Analyzer.

2. What is Syntax Analyser also known as
a) Hierarchical Analysis
b) Hierarchical Parsing
c) None of the mentioned
d) Both of the mentioned

View Answer

Answer: d [Reason:] It is also called as Hierarchical Analysis or Parsing.

3. Syntax Analyser takes Groups Tokens of source Program into Grammatical Production
a) True
b) False

View Answer

Answer: a [Reason:] It Groups Tokens of source Program into Grammatical Production

4. From where it take its input from?
a) Lexical analyser
b) Syntactic Analyser
c) Semantic Analyser
d) None of the mentioned

View Answer

Answer: a [Reason:] A syntax analyzer or parser takes the input from a lexical analyzer in the form of token streams.

5. Parsers are expected to parse the whole code
a) True
b) False

View Answer

Answer: a [Reason:] Parsers are expected to parse the whole code even if some errors exist in the program.

6. A grammar for a programming language is a formal description of
a) Syntax
b) Semantics
c) Structure
d) Library

View Answer

Answer: c [Reason:] The grammar clearly indicates that which type of a structure does a program has.

7. Which of these is not true about Symbol Table?
a) All the labels of the instructions are symbols
b) Table has entry for symbol name address value
c) Perform the processing of the assembler directives
d) Created during pass 1

View Answer

Answer: c [Reason:] The Symbol table does not ever perform the processing of the assembler derivative

8. Which of these features of assembler are Machine-Dependent
a) Instruction formats
b) Addressing modes
c) Program relocation
d) All of the mentioned

View Answer

Answer: d [Reason:] All of these options are features of assembler which are machine dependent

9. A compiler can check?
a) Logical Error
b) Syntax Error
c) Both Logical and Syntax Error
d) Not Logical and Syntax Error

View Answer

Answer: b [Reason:] No compiler can ever check logical errors

10. The fourth Generation computer was made up of?
a) Transistor
b) Vacuum tubes
c) Chips
d) Microprocessor chips

View Answer

Answer: d [Reason:] It is the only way to increase its throughput

Set 5

1. Select a Machine Independent phase of the compiler
a) Syntax Analysis
b) Intermediate Code generation
c) Lexical Analysis
d) All of the mentioned

View Answer

Answer: d [Reason:] All of them work independent of a machine

2. A system program that combines the separately compiled modules of a program into a form suitable for execution?
a) Assembler
b) Compiler
c) Linking Loader
d) Interpreter

View Answer

Answer: c [Reason:] A loader which combines the functions of a relocating loader with the ability to combine a number of program segments that have been independently compiled

3. Which of the following system software resides in the main memory always
a) Text Editor
b) Assembler
c) Linker
d) Loader

View Answer

Answer: d [Reason:] Loader is used to loading programs.

4. Output file of Lex is _____ the input file is Myfile?
a) Myfile.e
b) Myfile.yy.c
c) Myfile.lex
d) Myfile.obj

View Answer

Answer: b [Reason:] This Produce the file “myfile.yy.c” which we can then compile with g++

5. Type checking is normally done during?
a) Lexical Analysis
b) Syntax Analysis
c) Syntax Directed Translation
d) Code generation

View Answer

Answer: c [Reason:] It is the function of Syntax directed translation

6. Suppose One of the Operand is String and other is Integer then it does not throw error as it only checks whether there are two operands associated with ‘+’ or not .
a) True
b) False

View Answer

Answer: a [Reason:] Syntax analyzer does not check the type of the operand.

7. In Short Syntax Analysis Generates Parse Tree
a) True
b) False

View Answer

Answer: a [Reason:] Short Syntax Analysis generates a parse tree

8. By whom is the symbol table created?
a) Compiler
b) Interpreter
c) Assembler
d) None of the mentioned

View Answer

Answer: a [Reason:] Symbol table is created by the compiler which contains the list of lexemes or tokens.

9. What does a Syntactic Analyzer do?
a) Maintain Symbol Table
b) Collect type of information
c) Create parse tree
d) None of the mentioned

View Answer

Answer: c [Reason:] Syntax analyzer will just create parse tree. Semantic Analyzer checks the meaning of the string parsed.

10. Semantic Analyzer is used for?
a) Generating Object code
b) Main ting symbol table
c) None of the mentioned
d) Both of the mentioned

View Answer

Answer: d [Reason:] Maintaining the Symbol Table for each block. Source Program for Semantic Errors. Collects Type Information for Code Generation. Reporting compile-time errors in the code generating the object code (e.g., assembler or intermediate code)