C PROGRAMMING MCQS
1. The two type of file structures existing in VSAM file are
A) Key sequenced structures, entry sequenced structures
B) Key sequenced structure, exit sequenced structures
C) Entry sequenced structures, exit sequenced structures
D) None of the above
2. In a multilist organisation
A) records that have an equivalent value for a given secondary index item are linked together to form a list
B) records are loaded in ordered sequence defined by collating sequence by content of key
C) records are directly accessed by records key field
D) none of the above
3. *ptr ++ is equivalent to
A) ptr++
B) *ptr
C) ++ptr
D) ++*ptr
4. Declaration int *(*p) int(*a) is
A) A pointer to function that accept an integer argument and return an integer
B) A pointer to a, which returns an integer
C) A pointer to subroutine which returns an integer
D) None of the above
5. The output of following program would be
main()
{ printf(“d%d%d%” sizeof(3.14f), sizeof(3.14l);} is
A) 4,8,10
B) 8,4,10
C) 18,8,4
D) None of the above
6. An example of hierarchical data structure is
A) array
B) link list
C) tree
D) all of the above
7. The do..while looping statement
A) is executed only once if the conditions is true
B) is also known as entry-controlled loop
C) is executed at least once if the conditions is false
D) the unconditional loop
8.Which of the following is not a proper storage class in ‘C’?
A) auto
B) dec
C) static
D) extern
9.The average number of comparison is sequential search is
A) n**2
B) n(n-1)/2
C) n(n+1)/2
D) (n+1)/2
10. Which one is incorrect statement for C Language?
A) C does not perform any bound checking in array
B) Two pointers cannot be added.
C) String with white space cannot be entered by any means.
D) All arithmetic operators can be used as shorthand operators.
11. Which one is the binary operator group?
A) Conditional operator, bitwise XOR
B) << , += , dot
C) indirection, ! , ~
D) (int), ++
12. Which one of the following is incorrect for structure?
A) It is a convenient tool to handle a group of logically related data items.
B) Structure of array variables can be passed as argument in a function.
C) It is a user-defined data type.
D) Structure within structure is not supported.
13.Which of the following software translates source code into object code?
A) Compiler
B) Interpreter
C) Assembler
D) None
14.Which one of the following is not a keyword in C language?
A) main
B) endl
C) float
D) switch
15. Identify the invalid character constant:
A) '\n'
B) '$'
C) '12'
D) 'p'
16.What is the binary number equivalent of the decimal number 12?
A) 1100
B) 1010
C) 1001
D) 1110
17.Determine the order of evaluation of operations within the expression A<B&&C||D>A
A) &&, ||, <, >
B) <, >, &&, ||
C) >, <, &&, ||
D) &&,<, >, ||
18.How many times the printf statement within the while loop will be executed?
x=1;
while(x=0)
printf("hello");
A) 1
B) 0
C) infinite
D) 2
19.Find the output generated by the given program.
#include <stdio.h.>
B) link list
C) tree
D) all of the above
7. The do..while looping statement
A) is executed only once if the conditions is true
B) is also known as entry-controlled loop
C) is executed at least once if the conditions is false
D) the unconditional loop
8.Which of the following is not a proper storage class in ‘C’?
A) auto
B) dec
C) static
D) extern
9.The average number of comparison is sequential search is
A) n**2
B) n(n-1)/2
C) n(n+1)/2
D) (n+1)/2
10. Which one is incorrect statement for C Language?
A) C does not perform any bound checking in array
B) Two pointers cannot be added.
C) String with white space cannot be entered by any means.
D) All arithmetic operators can be used as shorthand operators.
11. Which one is the binary operator group?
A) Conditional operator, bitwise XOR
B) << , += , dot
C) indirection, ! , ~
D) (int), ++
12. Which one of the following is incorrect for structure?
A) It is a convenient tool to handle a group of logically related data items.
B) Structure of array variables can be passed as argument in a function.
C) It is a user-defined data type.
D) Structure within structure is not supported.
13.Which of the following software translates source code into object code?
A) Compiler
B) Interpreter
C) Assembler
D) None
14.Which one of the following is not a keyword in C language?
A) main
B) endl
C) float
D) switch
15. Identify the invalid character constant:
A) '\n'
B) '$'
C) '12'
D) 'p'
16.What is the binary number equivalent of the decimal number 12?
A) 1100
B) 1010
C) 1001
D) 1110
17.Determine the order of evaluation of operations within the expression A<B&&C||D>A
A) &&, ||, <, >
B) <, >, &&, ||
C) >, <, &&, ||
D) &&,<, >, ||
18.How many times the printf statement within the while loop will be executed?
x=1;
while(x=0)
printf("hello");
A) 1
B) 0
C) infinite
D) 2
19.Find the output generated by the given program.
#include <stdio.h.>
void main()
{
printf("Bre\nak");
printf("Bre\nak");
}
A) Break
B) Bre\nak
C) Break
D) None
A) Break
B) Bre\nak
C) Break
D) None
20.Which of the following is not an iterative statement?
A) switch
B) while
C) do while
D) for
21. Identify the storage class with which & operator cannot be used.
A) register
B) static
C) extern
D) auto
22. Identify the invalid declaration:
B) while
C) do while
D) for
21. Identify the storage class with which & operator cannot be used.
A) register
B) static
C) extern
D) auto
22. Identify the invalid declaration:
A) int &p;
B) int *p[10];
C) int **p;
D) int *p[ ];
23.What will be output if you compile and execute the following ‘C’ code?
void main(){
float a=5.2;
if(a==5.2)
printf("Equal");
else if(a<5.2)
printf("Less than");
else
printf("Greater than");
}
A) Equal
B) Less than
C) Greater than
D) Compilation error
24. What will be output if you compile and execute the following ‘C’ code?
void main(){
int i=4,x;
x=++i + ++i + ++i;
B) int *p[10];
C) int **p;
D) int *p[ ];
23.What will be output if you compile and execute the following ‘C’ code?
void main(){
float a=5.2;
if(a==5.2)
printf("Equal");
else if(a<5.2)
printf("Less than");
else
printf("Greater than");
}
A) Equal
B) Less than
C) Greater than
D) Compilation error
24. What will be output if you compile and execute the following ‘C’ code?
void main(){
int i=4,x;
x=++i + ++i + ++i;
printf("%d",x);
}
A) 21
}
A) 21
B) 18
C) 12
C) 12
D) Compilation error
25.The following code ‘for(;;)’ represents an infinite loop. It can be terminated by.
A) break
A) break
B) exit(0)
C) abort()
C) abort()
D) All of the mentioned
26.Arguments that take input by user before running a program are called?
A) main function arguments
B) main arguments
C) Command-Line arguments
D) Parameterized arguments
27.Automatic variables are allocated memory in
A) heap
26.Arguments that take input by user before running a program are called?
A) main function arguments
B) main arguments
C) Command-Line arguments
D) Parameterized arguments
27.Automatic variables are allocated memory in
A) heap
B) Data segment
C) Code segment
C) Code segment
D) stack.
28. End of file is detected by
A) fend( )
28. End of file is detected by
A) fend( )
B) endf( )
C) EOF
D) FEND
29. If the first string and the second string both are identical, then strcmp function returns
A) a value of 0
B) either 1 or 0
C) a value of 1
C) a value of 1
D) any positive integer
30. Register variable are active
A) outside the function
B) throughout the program
C) only in the function where it is defined
D) surrounding of that function
31. What will be the output of following program
#include <stdio.h>
30. Register variable are active
A) outside the function
B) throughout the program
C) only in the function where it is defined
D) surrounding of that function
31. What will be the output of following program
#include <stdio.h>
main()
{
int x,y = 10;
x = y * NULL;
printf(“\n %d \n", x);
}
A) error
printf(“\n %d \n", x);
}
A) error
B) 0
C) 10
C) 10
D) Garbage value
32.What is the output of this C code?
#include <stdio.h>
void main()
#include <stdio.h>
void main()
{
static int x;
if (x++ < 2)
main();
}
A) Infinite calls to main
if (x++ < 2)
main();
}
A) Infinite calls to main
B) Run time error
C) Varies
C) Varies
D) main is called twice
33.Which of the following is the correct order of evaluation for the below expression ?
33.Which of the following is the correct order of evaluation for the below expression ?
(A) * / % + – =
(B) = * / % + –
(C) / * % – + =
(D) * % / – + =
34.Which of the following is true for variable names in C ?
(A) They can contain alphanumeric characters as well as special characters.
(B) It is not an error to declare a variable to be one of the keywords
(like goto, static)
(C) Variable names cannot start with a digit.
(D) Variable can be of any length.
35. What is the output of this C code ?
#include <stdio.h>
int main( )
{
int x = 2, y = 0;
int z = y && (y |= 10);
printf("%d\n", z);
return 0;
}
(A) 1
(B) 0
(C) Undefined behaviour due to order of evaluation
(D) 2
36.Point out the error if any, in the while loop :
main( )
{
int i=1;
while ( )
{
printf(“%d”,i++);
if( i > 10)
break;
}}
(A) The condition in while loop is must
(B) There should be a semicolon in the while loop
(C) The while loop should be replaced by for loop
(D) No error
37. What is right way to initialize arrays ?
(A) int num[6]={2,4,12,5,45,5};
(B) int n{ }={2,4,12,5,45,5};
(C) int n{6}={2,4,12};
(D) int n(6)={2,4,12,5,45,5};
38. In C, if you pass an array as an argument to a function, what actually gets passed ?
(A) Value of elements in array
(A) They can contain alphanumeric characters as well as special characters.
(B) It is not an error to declare a variable to be one of the keywords
(like goto, static)
(C) Variable names cannot start with a digit.
(D) Variable can be of any length.
35. What is the output of this C code ?
#include <stdio.h>
int main( )
{
int x = 2, y = 0;
int z = y && (y |= 10);
printf("%d\n", z);
return 0;
}
(A) 1
(B) 0
(C) Undefined behaviour due to order of evaluation
(D) 2
36.Point out the error if any, in the while loop :
main( )
{
int i=1;
while ( )
{
printf(“%d”,i++);
if( i > 10)
break;
}}
(A) The condition in while loop is must
(B) There should be a semicolon in the while loop
(C) The while loop should be replaced by for loop
(D) No error
37. What is right way to initialize arrays ?
(A) int num[6]={2,4,12,5,45,5};
(B) int n{ }={2,4,12,5,45,5};
(C) int n{6}={2,4,12};
(D) int n(6)={2,4,12,5,45,5};
38. 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 array
(C) Base address of array
(D) Address of the last element of array
39. The output of above program is :
# include <stdio.h>
void fun(int *ptr)
{
*ptr = 30;
}
(C) Base address of array
(D) Address of the last element of array
39. The output of above program is :
# include <stdio.h>
void fun(int *ptr)
{
*ptr = 30;
}
int main( )
{
int y = 20;
fun(&y);
printf("%d", y);
return 0;
}
(A) 20
(B) 30
(C) Compiler error
(D) Runtime error
40. If the two strings are identical, then strcmp( ) function returns.
(A) –1
(B) 1
(C) 0
(D) infinity
{
int y = 20;
fun(&y);
printf("%d", y);
return 0;
}
(A) 20
(B) 30
(C) Compiler error
(D) Runtime error
40. If the two strings are identical, then strcmp( ) function returns.
(A) –1
(B) 1
(C) 0
(D) infinity
41.What is the maximum number of dimensions an array in C may have ?
(A) 2
(B) 8
(C) 20
(D) Theoretically no limits. The only practical limits are memory and compilers.
42. Is the following statement declaration or definition :
extern int i;
(A) Declaration
(B) Definition
(C) Function
(D) Error
(A) 2
(B) 8
(C) 20
(D) Theoretically no limits. The only practical limits are memory and compilers.
42. Is the following statement declaration or definition :
extern int i;
(A) Declaration
(B) Definition
(C) Function
(D) Error
1 Comments
Thank you so much sir 🙏
ReplyDeleteHey, What do you think about this post