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 CLI command can also be used to rename files ?
a) rm
b) mv
c) rm -r
d) none of the mentioned

View Answer

Answer: b [Reason:] mv stands for move.

2. Point out the correct statement :
a) CLI can help you to organize messages
b) CLI can help you to organize files and folders
c) Navigation of directory is possible using CLI
d) None of the Mentioned

View Answer

Answer: b [Reason:] CLI stands for Command Line Interface.

3. Which of the following command allows you to change directory to one level above your parent directory ?
a) cd
b) cd.
c) cd..
d) none of the Mentioned

View Answer

Answer: c [Reason:] cd stands for change directory.

4. Which of the following is not a CLI command ?
a) delete
b) rm
c) clear
d) none of the Mentioned

View Answer

Answer: a [Reason:] rm can be used to remove files and directories.

5. Point out the wrong statement:
a) Command is the CLI command which does a specific task
b) There is one and only flag for every command in CLI
c) Flags are the options given to command for activating particular behaviour
d) All of the Mentioned

View Answer

Answer: b [Reason:] Depending on the command,there can be zero or more flags and arguments.

6. Which of the following systems record changes to a file over time ?
a) Record Control
b) Version Control
c) Forecast Control
d) None of the mentioned

View Answer

Answer: b [Reason:] Version control is also known as revision control.

7. Which of the following is a revision control system ?
a) Git
b) NumPy
c) Slidify
d) None of the mentioned

View Answer

Answer: a [Reason:] Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

8. Which of the following command line environment is used for interacting with Git ?
a) GitHub
b) Git Bash
c) Git Boot
d) All of the mentioned

View Answer

Answer: b [Reason:] Git for Windows provides a BASH emulation used to run Git from the command line.

9. Which of the following web hosting service use Git control system ?
a) GitHub
b) Open Hash
c) Git Bash
d) None of the mentioned

View Answer

Answer: a [Reason:] GitHub is a Web-based Git repository hosting service, which offers all of the distributed revision control and source code management (SCM) functionality of Git.

10. cp command can be used to copy the content of directories.
a) True
b) False

View Answer

Answer: a [Reason:] -r flag should be used for copying the content.

Set 2

1. The correct syntax to access the member of the ith structure in the array of structures is?

 Assuming: struct temp
    {
        int b;
    }s[50];

a) s.b.[i];
b) s.[i].b;
c) s.b[i];
d) s[i].b;

View Answer

Answer: d

2. Comment on the output of this C code?

  1.     #include <stdio.h>
  2.     struct temp
  3.     {
  4.         int a;
  5.         int b;
  6.         int c;
  7.     };
  8.     main()
  9.     {
  10.         struct temp p[] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
  11.     }

a) No Compile time error, generates an array of structure of size 3
b) No Compile time error, generates an array of structure of size 9
c) Compile time error, illegal declaration of a multidimensional array
d) Compile time error, illegal assignment to members of structure

View Answer

Answer: a

3. Which of the following uses structure?
a) Array of structures
b) Linked Lists
c) Binary Tree
d) All of the mentioned

View Answer

Answer: d

4. What is the correct syntax to declare a function foo() which receives an array of structure in     function?
a) void foo(struct *var);
b) void foo(struct *var[]);
c) void foo(struct var);
d) none of the mentioned

View Answer

Answer: a

5. What is the output of this C code?
    (Assuming size of int be 4)

  1.     #include <stdio.h>
  2.     struct temp
  3.     {
  4.         int a;
  5.         int b;
  6.         int c;
  7.     } p[] = {0};
  8.     main()
  9.     {
  10.         printf("%d", sizeof(p));
  11.     }

a) 4
b) 12
c) 16
d) Can’t be estimated due to ambigous initialization of array

View Answer

Answer: b

6. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.         char *name;
  5.     };
  6.     struct student s[2];
  7.     void main()
  8.     {
  9.         s[0].name = "alan";
  10.         s[1] = s[0];
  11.         printf("%s%s", s[0].name, s[1].name);
  12.         s[1].name = "turing";
  13.         printf("%s%s", s[0].name, s[1].name);
  14.     }

a) alan alan alan turing
b) alan alan turing turing
c) alan turing alan turing
d) run time error

View Answer

Answer: a

7. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.         char *name;
  5.     };
  6.     struct student s[2], r[2];
  7.     void main()
  8.     {
  9.         s[0].name = "alan";
  10.         s[1] = s[0];
  11.         r = s;
  12.         printf("%s%s", r[0].name, r[1].name);
  13.     }

a) alan alan
b) Compile time error
c) Varies
d) Nothing

View Answer

Answer: b

8. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.         char *name;
  5.     };
  6.     void main()
  7.     {
  8.         struct student s[2], r[2];
  9.         s[1] = s[0] = "alan";
  10.         printf("%s%s", s[0].name, s[1].name);
  11.     }

a) alan alan
b) Nothing
c) Compile time error
d) Varies

View Answer

Answer: c

9. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.     };
  5.     void main()
  6.     {
  7.         struct student s[2];
  8.         printf("%d", sizeof(s));
  9.     }

a) 2
b) 4
c) 8
d) 0

View Answer

Answer: d

Set 3

1. Size of a union is determined by size of the.
a) First member in the union
b) Last member in the union
c) Biggest member in the union
d) Sum of the sizes of all members

View Answer

Answer: c

2. Comment on the following union declaration?

  1.     #include <stdio.h>
  2.     union temp
  3.     {
  4.         int a;
  5.         float b;
  6.         char c;
  7.     };

    union temp s = {1,2.5,’A’}; //REF LINE
    Which member of the union will be active after REF LINE?
a) a
b) b
c) c
d) Such declaration are illegal

View Answer

Answer: a

3. What would be the size of the following union declaration?

  1.     #include <stdio.h>
  2.     union uTemp
  3.     {
  4.         double a;
  5.         int b[10];
  6.         char c;
  7.     }u;

    (Assuming size of double = 8, size of int = 4, size of char = 1)
a) 4
b) 8
c) 40
d) 80

View Answer

Answer: c

4. What type of data is holded by variable u int this C code?

  1.     #include <stdio.h>
  2.     union u_tag
  3.     {
  4.         int ival;
  5.         float fval;
  6.         char *sval;
  7.     } u;

    The variable u here
a) Will be large enough to hold the largest of the three types;
b) Will be large enough to hold the smallest of the three types;
c) Will be large enough to hold the all of the three types;
d) None of the mentioned

View Answer

Answer: a

5. Members of a union are accessed as________________
a) union-name.member
b) union-pointer->member
c) both union-name.member & union-pointer->member
d) none of the mentioned

View Answer

Answer: c

6. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct
  3.     {
  4.         char *name;
  5.         union
  6.         {
  7.             char *sval;
  8.         } u;
  9.     } symtab[10];

    the first character of the string sval by either of
a) *symtab[i].u.sval
b) symtab[i].u.sval[0].
c) You cannot have union inside structure
d) Both *symtab[i].u.sval & symtab[i].u.sval[0].

View Answer

Answer: d

7. What is the output of this C code(size of int and float is 4)?

  1.     #include <stdio.h>
  2.     union
  3.     {
  4.         int ival;
  5.         float fval;
  6.     } u;
  7.     void main()
  8.     {
  9.         printf("%d", sizeof(u));
  10.     }

a) 16
b) 8
c) 4
d) 32

View Answer

Answer: c

8. What is the output of this C code?

  1.     #include <stdio.h>
  2.     union stu
  3.     {
  4.         int ival;
  5.         float fval;
  6.     };
  7.     void main()
  8.     {
  9.         union stu r;
  10.         r.ival = 5;
  11.         printf("%d", r.ival);
  12.     }

a) 9
b) Compile time error
c) 16
d) 5

View Answer

Answer: d

Set 4

Here is a listing of tough C questions on “Line Input & Output” along with answers, explanations and/or solutions:

1. What is the size of array “line” used in fgets(line, maxline, *fp) function?
a) maxline – 1
b) maxline
c) maxline + 1
d) Size is dynamic

View Answer

Answer: b

2. The following function
    int fputs(char *line, FILE *fp)
    returns EOF when:
a) ‘�’ character of array line is encountered
b) ‘n’ character in array line is encountered
c) ‘t’ character in array line is encountered
d) When an error occurs

View Answer

Answer: d

3. Identify X library function for line input and output?

  1.     #include <stdio.h>
  2.     int X(char *s, FILE *iop)
  3.     {
  4.         int c;
  5.         while (c = *s++)
  6.         putc(c, iop);
  7.         return ferror(iop) ? EOF : 0;
  8.     }

a) getc
b) putc
c) fgets
d) fputs

View Answer

Answer: d

4. Which function has a return type as char pointer?
a) getline
b) fputs
c) fgets
d) All of the mentioned

View Answer

Answer: c

5. Which of the following is the right declaration for fgets inside the library?
a) int *fgets(char *line, int maxline, FILE *fp);
b) char *fgets(char *line, int maxline, FILE *fp);
c) char *fgets(char *line, FILE *fp);
d) int *fgets(char *line, FILE *fp);

View Answer

Answer: b

6. Which is true about fputs.fputs returns?
a) EOF if an error occurs
b) Non-negative if no error
c) EOF if an error occurs & Non-negative if no error
d) None of the mentioned

View Answer

Answer: c

7. gets and puts operate on
a) stdin and stdout
b) files
c) stderr
d) nothing

View Answer

Answer: a

8. gets does the following when it reads from stdin
a) Deletes the ‘t’
b) Puts adds it.
c) Deletes the terminating ‘n’
d) Nothing

View Answer

Answer: c

Set 5

1. Which of the following mathematical function requires 2 parameter for successful function call?
a) fmod();
b) div();
c) atan2();
d) all of the mentioned

View Answer

Answer: d

2. Which mathematical function among the following does NOT require int parameters?
a) div(x, y);
b) srand(x);
c) sqrt(x);
d) all of the mentioned

View Answer

Answer: c

3. sin(x) returns
a) sine of x where x is in radians
b) sine of x where x is in degree
c) cosine of x where x is in radians
d) cosine of x where x is in degree

View Answer

Answer: a

4. cos(x) returns
a) sine of x where x is in radians
b) sine of x where x is in degree
c) cosine of x where x is in radians
d) cosine of x where x is in degree

View Answer

Answer: c

5. What is the output of this C code?

  1.     #include <stdio.h>
  2.     #include <math.h>
  3.     void main()
  4.     {
  5.         int k = pow(2, 3);
  6.         printf("%dn", k);
  7.     }

a) 9
b) 8
c) -1
d) 6

View Answer

Answer: b

6. What is the output of this C code?

  1.     #include <stdio.h>
  2.     #include <math.h>
  3.     void main()
  4.     {
  5.         int k = fabs(-87);
  6.         printf("%dn", k);
  7.     }

a) -87
b) 87
c) 78
d) error

View Answer

Answer: b

7. What is the output of this C code?

  1.     #include <stdio.h>
  2.     #include <math.h>
  3.     void main()
  4.     {
  5.         int k = sqrt(-4);
  6.         printf("%dn", k);
  7.     }

a) -2
b) 2
c) Compile time error
d) NaN

View Answer

Answer: d

8. Which among the following mathematical function do not have a “double” return-type?
a) srand(x);
b) ceil(x);
c) floor(x);
d) both ceil(x); and floor(x);

View Answer

Answer: a

.woocommerce-message { background-color: #98C391 !important; }