Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

main() { int x = 0; for (; ;) { if ( x++ == 4) break; continue; } printf(“x = %d\n”, x); } What will be printed when the above code is executed?

A. X = 0
B. X = 1
C. X = 4
D. X = 5
Answer» E.
2.

if default statement is omitted and there is no match with the case table

A. No statement within switch case will be executed
B. Syntax error is produced
C. Executes all the statements in the switch case construct
D. Executes the last case statement only
Answer» B. Syntax error is produced
3.

do-while loop terminates when conditional expression returns?

A. Zero
B. One
C. Non-zero
D. -1
Answer» B. One
4.

Which of the following cannot be checked in a switch-case statement?

A. Character
B. Integer
C. Float
D. enum
Answer» D. enum
5.

 In mathematics and computer programming, which is the correct order of mathematical operators ?

A. Addition, Subtraction, Multiplication, Division
B. Division, Multiplication, Addition, Subtraction
C. Multiplication, Addition, Division, Subtraction
D. Addition, Division, Modulus, Subtraction
Answer» C. Multiplication, Addition, Division, Subtraction
6.

A program is a:

A. Javascript for a theatrical play
B. Set of implementations
C. A list of instructions (actions) to accomplish a task
D. What you watch on TV
Answer» D. What you watch on TV
7.

The size of a structure can be determined by a. size of variable name b. size of (struct tag)"

A. Only a
B. Only b
C. Both a and b
D. None of these options
Answer» D. None of these options
8.

 What is the result of 16>>2?

A. 4
B. 8
C. 3
D. 0
Answer» B. 8
9.

Who calls to the fuction main()

A. kernel
B. operating system
C. cpu
D. ALU
Answer» C. cpu
10.

The library function used to find the last occurrence of a character in a string is 

A. strnstr()
B. laststr()
C. strrchr()
D. strstr()
Answer» D. strstr()
11.

The function that calls itself for its processing is known as.

A. Inline Function
B. Nested Function
C. Overloaded Function
D. Recursive Function
Answer» E.
12.

Can you use the fprintf() to display the output on the screen?

A. Yes
B. No
Answer» B. No
13.

 Which standard library function will you use to find the last occurance of a character in a string in C?

A. strnchar()
B. strchar()
C. strrchar()
D. strrchr()
Answer» E.
14.

  Input/output function prototypes and macros are defined in which header file?

A. conio.h
B. stdlib.h
C. stdio.h
D. dos.h
Answer» D. dos.h
15.

What will the function rewind() do?

A. Reposition the file pointer to a character reverse.
B. Reposition the file pointer stream to end of file.
C. Reposition the file pointer to begining of that line.
D. Reposition the file pointer to begining of file.
Answer» E.
16.

What do the following declaration signify?  int (*pf)();

A. pf is a pointer to function.
B. pf is a function pointer.
C. pf is a pointer to a function which return int
D. pf is a function of pointer variable.
Answer» D. pf is a function of pointer variable.
17.

What do the following declaration signify?  char *arr[10];

A. arr is a array of 10 character pointers.
B. arr is a array of function pointer
C. arr is a array of characters.
D. arr is a pointer to array of characters.
Answer» B. arr is a array of function pointer
18.

  Specify the 2 library functions to dynamically allocate memory?

A. malloc() and memalloc()
B. alloc() and memalloc()
C. malloc() and calloc()
D. memalloc() and faralloc()
Answer» D. memalloc() and faralloc()
19.

 How will you free the memory allocated by the following program?  #include<stdio.h> #include<stdlib.h> #define MAXROW 3 #define MAXCOL 4 int main() {      int **p, i, j;      p = (int **) malloc(MAXROW * sizeof(int*));      return 0; }

A. memfree(int p);
B. dealloc(p);
C. malloc(p, 0);
D. free(p);
Answer» E.
20.

In the following code what is 'P'?  typedef char *charp; const charp P;

A. P is a constant
B. P is a character constant
C. P is character type
D. None of the above
Answer» B. P is a character constant
21.

 In the following code, the P2 is Integer Pointer or Integer?  typedef int *ptr; ptr p1, p2;

A. Integer
B. Integer pointer
C. Error in declaration
D. None of the above
Answer» C. Error in declaration
22.

   What do the 'c' and 'v' in argv stands for?

A. c means argument control v means argument vector
B. c means argument count v means argument vertex
C. c means argument count v means argument vector
D. c means argument configuration v means argument visibility
Answer» D. c means argument configuration v means argument visibility
23.

 The maximum combined length of the command-line arguments including the spaces between adjacent arguments is

A. 128 characters
B. 256 characters
C. 67 characters
D. It may vary from one operating system to another
Answer» E.
24.

   How will you free the allocated memory?

A. remove(var-name);
B. free(var-name);
C. delete(var-name);
D. dalloc(var-name);
Answer» C. delete(var-name);
25.

 In C, if you pass an array as an argument to a function, what actually gets passed?

A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Address of the last element of array
Answer» D. Address of the last element of array
26.

What will be the output of the program?  #include<stdio.h> int main() {      int y=128;      const int x=y;      printf("%d\n", x);      return 0; }  

A. 128
B. Garbage value
C. Error
D. 0
Answer» B. Garbage value
27.

Which of the following cannot be static in C?

A. Variables
B. Functions
C. Structures
D. None of the mentioned
Answer» E.
28.

  What is the output of this C code?   #include <stdio.h> void main() {     static int x;     if (x++ < 2)     main(); }

A. Infinite calls to main
B. Run time error
C. Varies
D. main is called twice
Answer» E.
29.

  What is the output of this C code?   #include <stdio.h> struct student {     char a[5]; }; void main() {     struct student s[] = {"hi", "hey"};     printf("%c", s[0].a[1]); }

A. h
B. i
C. e
D. y
Answer» C. e
30.

  What is the output of the below c code?   #include <stdio.h> void main() {     char *s = "hello";     char *p = s;     printf("%p\t%p", p, s); }

A. Different address is printed
B. Same address is printed
C. Run time error
D. Nothing
Answer» C. Run time error
31.

 Default storage class if not any is specified for a local variable, is auto

A. true
B. false
C. Depends on the standard
D. None of the mentioned
Answer» B. false
32.

 What is the output of this C code?   #include <stdio.h> int main() {     printf("Hello World! %d \n", x);     return 0; }

A. Hello World! x;
B. Hello World! followed by a junk value
C. Compile time error
D. Hello World!
Answer» D. Hello World!
Previous Next