Remix education
EngineeringTopic wise MCQs

Programming for Problem Solving MCQs with Answers

 

1)  Which Of The Following Are Components Of Central Processing Unit (CPU)?
A) Arithmetic Logic Unit, Mouse
B)Arithmetic Logic Unit, Control Unit
C)Arithmetic Logic Unit, Integrated Circuits
D) Control Unit, Monitor
Ans. B)

2)  In Which Of The Following Form, Data Is Stored In Computer?
A) Decimal
B) Binary
C) Hexadecimal
D) Octal
Ans. B)

3)  Which Level Language Is Assembly Language?
A) High-Level Programming Language
B) Medium-Level Programming Language
C) Low-Level Programming Language
D) Machine Language
Ans. C)

4)  1 Mega Byte Is Equal To
A) 1024 Bytes
B) 1024 Kilo Bytes
C) 1024 Giga Bits
D) 1024 Bits
Ans. B)

5)  One Byte Is Equal To How Many Bits ?
A) 4 Bits
B) 8 Bits
C) 12 Bits
D) 16 Bits
Ans. B)

6)  One Nibble Is Equal To How Many Bits ?
A)4 Bits
B) 8 Bits
C) 12 Bits

D) 16 Bits
Ans. A)

7) An Assembler Is Used To Translate A Program Written In ?
A) Low-Level Language
B) Machine Language
C) Assembly Language
D) High-Level Language
Ans. C)

8) We Can Insert Pre Written Code In A C Program By Using
A) #Read
B) #Get
C) #Include
D) #Put
Ans. C)

9) Ritchie And Brian Kernighan Jointly Carried Out The Development Of C And That Version Is ________ .
A) ISO C
B) K&R C
C) ANSI C
D) R&K C
Ans. B)

10) Who Was Creator Of B Language, Which Inspired Dennis Ritchie To Create Strong Procedural Language Called C?
A) Thomas E. Kurtz
B) James Gosling
C) Brian Kernighan
D) Ken Thompson
Ans. D)

11) Which Committee Standardize C Programming Language?
A) W3C
B) ANSI
C) ISO
D) TRAI
Ans. B)

 

12) Dennis Was Author Of Famous Programming Book _________ .
A) Thinking In C
B) C Programming For Scientist
C) The C Programming Language
D) C Programming And Techniques
Ans. C)

13) Many Features Of C Were Derived From An Earlier Language Called _____.
A) PASCAL
B) BASIC
C) FORTRAN
D) B
Ans. D)

14)  C Programming Was Created At ______ By Dennis Ritchie.
A) AT&T Bell Laboratory
B) Stanford Lab
C) MIT University
D) Haward University
Ans. A) 

15) Which Type Of Software Is An Operating System?
A) Utility Software
B) System Software
C) Application Software
D) Firmware Software
Ans. B)

16) Microsoft Office Is Type Of?
A) Utility Software
B) System Software
C) Application Software
D) Firmware Software
Ans. C)

 

17) How Many Main() Function We Can Have In Our Project?
A) 1
B) 2
C) No Limit
D) Depends On Compiler
Ans. A)

18) Is It Possible To Run Program Without Main() Function?
A) Yes
B) No
C) Option.
D) Option.
Ans. A)

19) What Is Sizeof() In C?
A) Operator
B) Function
C) Macro
D) None Of These
Ans. A)

20) Bitwise Operators Can Operate Upon?
A) Double And Chars
B) Floats And Doubles
C) Int And Floats
D) Int And Chars
Ans. D)

21) What Is C Tokens?
A) The Smallest Individual Units Of C Program
B) The Basic Element Recognized By The Compiler
C) The Largest Individual Units Of Program
D) A & B Both
Ans. D)

22) What Is Keywords?
A) Keywords Have Some Predefine Meanings And These Meanings Can Be Changed.
B) Keywords Have Some Unknown Meanings And These Meanings Cannot Be Changed

C) Keywords Have Some Predefine Meanings And These Meanings Cannot Be Changed.
D) None Of The Above
Ans. C)

23) What Is Constant?
A) Constants Have Fixed Values That Do Not Change During The Execution Of A Program
B) Constants Have Fixed Values That Change During The Execution Of A Program
C) Constants Have Unknown Values That May Be Change During The Execution Of A Program
D) Option.
Ans. A)

24) Which Is The Right Way To Declare Constant In C?
A) Int Constant Var =10;
B) Int Const Var = 10;
C) Const Int Var = 10;
D) B & C Both
Ans. D)

25) Which Operators Are Known As Ternary Operator?
A) ::, ?.
B) ?, :
C) ?, ;;
D) None Of The Above
Ans. B)

26) Total Number Of Keywords In C Are
A) 30
B) 12
C) 34
D) 32
Ans. D)

27) The Compiler In C Ignores All Text Till The End Of Line Using
A) //
B) /
C) */

D) /*/
Ans. A)

28) Printf() Belongs To Which Library Of C
A) Stdlib.H
B) Stdio.H
C) Stdout.H
D) Stdoutput.H
Ans. B)

29) What Is Correct Order Of Precedence In C
A) Addition, Division, Modulus
B) Addition, Modulus, Division
C) Multiplication, Substration, Modulus
D) Modulus, Multiplication, Substration
Ans. D)

30) In Switch Statement, Each Case Instance Value Must Be _______?
A) Constant
B) Variable
C) Special Symbol
D) None Of The Above
Ans. A)

31)  What Is The Work Of Break Keyword?
A) Halt Execution Of Program
B) Restart Execution Of Program
C) Exit From Loop Or Switch Statement
Ans. C)

32) Which One Of The Following Sentences Is True ?
A) The Body Of A While Loop Is Executed At Least Once.
B) The Body Of A Do … While Loop Is Executed At Least Once.
C) The Body Of A Do … While Loop Is Executed Zero Or More Times.
D) A For Loop Can Never Be Used In Place Of A While Loop.
Ans. B)

33) A C Variable Cannot Start With
A) An Alphabet
B) A Number

C) A Special Symbol Other Than Underscore
D) Both (B) And (C)
Ans. D)

34) Which Of The Following Shows The Correct Hierarchy Of Arithmetic Operations In C
A) / + * –
B) * – / +
C) + – / *
D) * / + –
Ans. D)

35) Int Main()
       {
       Extern Int I;
       I = 20;
       Printf(“%D”, Sizeof(I));
       Return 0;
        }
A) 20B0
C) Undefined Reference To I
D) Linking Error
Ans. C)
        Note :- Extern Int I; Tell The Compiler That Int I Is Declared In Some Other File, In This Code We Have Not Included Any Other Header File So It Will Cause Compilation Error.

36) Is The Following Statement A Declaration Or DefinitionExtern Int I;
A) Declaration
B) Definition
Ans. A)

37) Int Main()
       {
            Int X = 10;
                  {                                                                                                                                                                                                      Int X = 0;
                        Printf(“%D”,X);
                   }
           Return 0;
        }
A  10
B  Compilation Error
C   0
D  Undefined
Ans. C

38
         //This Program Is Compiled On 32 Bit DEV-C++
         Int Main()
         {
         Char *Ptr1, *Ptr2;
         Printf(“%D %D”, Sizeof(Ptr1), Sizeof(Ptr2));

         Return 0;
         }
A   1 1
B   2 2
C   4 4
Ans. C

39
          What Should Be The Output:
          Int Main()
          {
                Int A = 10/3;
                Printf(“%D”,A);

  
               Return 0;
           }
A   3.33
B   3.0
C   3
D   Option.
Ans. C

        Note :- Integer Division (Int/ Int) Is Int Only Hence Instead Of Printing 3.33 It Will Print 3 Only. Float   Part Is Discarded In Such Cases.

40 Which Of The Following Is Executed By Preprocess?
A  #Include<Stdio.H>
B  Return 0
C  Void Main(Int Argc , Char ** Argv)
Ans. A

41
        Int Main()
        {
              Int A = 10.5;
              Printf(“%D”,A);
              Return 0;
        }
A  10.5
B  10.0
C  10
D Compilation Error
Ans. C
       Note :- Compiler Will Convert Float Values To Integer Value After Seeing %D So Instead Of Printing 10.5 It Will Print It Integer Value I.E 10

42
          Int Main()
          {
                 Int _ = 10;
                 Int __ = 20;
                 Int ___ = _ + __;
                 Printf(“__%D”,___);
                Return 0;
           }
A  Compilation Error
B  Runtime Error
C  __0
D  __30
Ans. D
       Note :- Multiple Underscore Ie. _ Can Be Used To Create Variables.

43
         Int Main()
        {
              Int A = 5;
              Int B = 10;
              Int C = A+B;
              Printf(“%I”,C);
A 0
B 15
C Undefined I
D Any Other Compiler Error
Ans. B
     Note :- %I Is Also Used To Printf Numeric Values In C. %D And %I Both Solve The
Same Purpose.

44
          int main()
         {
              int x;
              x=10,20,30;
              printf(“%d”,x);
              return 0;
         }
A 10
B 20
C 30
D Compilation Error
Ans. A
      Note :- When there are multiple , then assignment takes place from right to left hence 10 is the last value which is assign to x variable.

45 How many times C.com is printed?
     int main()
     {
     int a = 0;
     while(a++ < 5-++a)
     printf(“C.com”);
     return 0;
     }
A 5 times

B 4 times
C 3 times
D 1 times
Ans. D

46 How many times C.com is printed?

      int main()
      {
      int a = 0;
      while(a++ < 5)
      printf(“C.com”);
      return 0;
      }
A 5 times
B 4 times
C 3 times
D 1 times
Ans. A
     Note :- Here while loop is execrated for a = 0 to a = 4 which is 5 times execution hence C.com is printed 5 times.

47 How many times C.com is printed?
      int main()
      {
      int a = 0;
      while(a++)
      printf(“C.com”);

      return 0;
      }
A 1 time
B 0 time
C Infinite times(Untill Stack is overflow)
D 2 times
Ans. B
      Note :- Here while loop is evaluated as while(0) which means it will be executed 0 times and since printf is also part of it so nothing would be printed.

      Note:- if there are no { } braces after any loop then only the next statement is considered as a part of the loop.

48 How many times C.com is printed?
      int main()
      {
      int a = 0;
      while(++a)
      {
            printf(“C.com”);
      }

      return 0;
      }
A 1 time
B Infinite Times(Untill Stack is overflow)
C 2 times
D Error
Ans. B
     Note :- Here while loop is evaluated as while(1) which means it will run infinite times.

49 What is output of below program?
       int main()
       {
       int i,j,count;
       count=0;
       for(i=0; i<5; i++);
      {
              for(j=0;j<5;j++);
              {
                    count++;
              }
      }
      printf(“%d”,count);
      return 0;
      }
A  55

Remix education

B  54
C  1
D  0
Ans. C
Note :- if we put ; after for() then for loop doesn’t run anything which is inside {}

50 What is output of below program?
       int main()
       {
       int i,j,k,count;
       count=0;
       for(i=0;i<5;i++)
       {
           for(j=0;j<5;j++)
           {
               count++;
            }
        }
         printf(“%d”,count);
         return 0;
         }
A  5
B  10
C  25
D  50
Ans. C
        Note :- This code has 25 iterations of for loops that is why count++ is executed 25 times hence its value becomes 25.