Type Here to Get Search Results !

C Programming MCQ with Answers [ SET - 8 ] | Computer Programming Mcq with Answers

 Computer Programming Mcq with Answers

computer programming mcq with answers

1. Can you combine the following two statements into one? 

char *p 

p = (char*) malloc(100);

    char p = *malloc(100)
     char p = (char) malloc(100) 
    char p = (char) malloc(100)
ANSWER= (C) char p = (char) malloc(100)

 

2. B. Constants have fixed values that change during the execution

    of a program
    constants have unknown values that may be change during the execution
     of a program
ANSWER= (A) of a program

 

3. If a=14, b=4 then a/b =





ANSWER= (B) 3

 

4. In the following code, the P2 is Integer Pointer or Integer? 

typederf int*ptr;

ptr pl, p2; 

    Integer
    Integer pointer
     Error in declaration
ANSWER= (B) Integer pointer

 

5. Can you combine the following two statements into one? 

char *p; 

p = (char)malloc(100);

    char p =*malloc(100)
    char p = (char) malloc(100)
    char p = (char)malloc(100)
ANSWER= (C) char p = (char)malloc(100)

 

6.  If a=14, b=4 then a%b =





ANSWER= (A) 2

 

7. The typedef statement is used for -

    declaring user defined data types
    declaring variant variables
    for type casting of variables 
ANSWER= (D) none of the above

 

8. A bit field is a set of adjacent bits whose size can be from _________ bits in length

     1 to 8
    1 to 12
    1 to 14
ANSWER= (D) 1 to 16

 

9. A multidimensional array can be expressed in terms of

    array of pointers rather than as pointers to a group of a contiguous array
    array without the group of a contiguous array
    data type arrays
ANSWER= (A) array of pointers rather than as pointers to a group of a contiguous array

 

10.The member variables of structure are accessed by using -

    dot (.) operator
    arrow (→) operator
    asterisk (*) operator
ANSWER= (A) dot (.) operator

 

11. The precedence of member operator is _________ than all arithmatic and relational operator

    lower
    higher
    equal
ANSWER= (B) higher

 

12. If you want to exchange two rows in a two-dimensional array, the fastest way is to:

    Exchange the elements of the 2rows
    Exchange the address of each element in the two rows
    Silence the address of the rows in an array of the pointer and exchange the pointer
ANSWER= (C) Silence the address of the rows in an array of the pointer and exchange the pointer

 

13. Identify the most appropriate sentence to describe union - 

    unions contain members of different data types witch share the same storage area in memory
     unions are like structures
     unions are less frequency used in the program
ANSWER= (A) unions are used for self operations..

 

14. Automatic variable also referred to as

    Internal variable
    Global variable
     Local variable
ANSWER= (A) Internal variable

 

15. The union holds

    one object at a time
     multiple objects
    both (a) and (b)
ANSWER= (A) one object at a time

 

16. The …… variable is not destroyed on exit from the function; instead its value is presented and becomes available again. When the function is next called. These variables are declared as …….

    extern, localvariable
    Static, global variable
    Static, local variable
ANSWER= (C) Static, local variable

 

17. For a method to be an interface between the outside world and a class , it has to be declared

    private
    public
    external
ANSWER= (B) public

 

18. Bit fields are used only with

     unsigned int data type
    float data type
    char data type
ANSWER= (A)  unsigned int data type

 

19. int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

What value does testarray[2][1][0] in the sample code above contain?





ANSWER= (A) 11

 

20. void main()

{

int a=10,b=20;

char x=1,y=0;

if(a,b,x,y)

{

printf(“EXAM”);

}

}

What is the output?

    XAM is printed
    exam is printed
    Compiler Error
ANSWER= (D) Nothing is printed

 

21. The number of bytes required for enumerated data type in memory are -

    2 bytes
    4 bytes
    1 byte 
ANSWER= (A) 2 bytes

 

22. What is the similarity between a structure, union and enumeration? 

    All of them let you define new values
    All of them let you define new data types
     All of them let you define new pointers
ANSWER= (B) All of them let you define new data types

 

23. What will be output if you will compile and execute the following c code?

#define message “union is

power of c”

void main(){

clrscr();

printf(“%s”,message);

getch();

}

     union is power of c
    union ispower of c
    union is
ANSWER= (B) union ispower of c

 

24. Which escape character can be used to beep from speaker in C?

    \a
    \b
    \m

ANSWER= (A) \a

 

25. Character constants should be enclosed between ___

    Single quotes
    Double quotes
     Both a and
ANSWER= (A) Single quotes

 

26. String constants should be enclosed between ___

     Single quotes
    Double quotes
    Both a and b
ANSWER= (B) Double quotes

 

27. Which of the following is invalid?

     ‘’
     ““
    ‘a’
ANSWER= (D) ‘abc’

 

28. The variables declared in a structure definition are called its 

    group variables 
     merged variables 
    member variables 
ANSWER= (C) member variables 

 

29. #define' preprocessor statement can be used for defining - 

    macro 
     function 
     symbolic constants only 
ANSWER= (A) macro 

 

30. The _______ chars have values from -128 to 127.

    signed
    unsigned
    long
ANSWER= (A) signed





Friends if you like this post,kindly comment bellow and do share your responce.Thank You for Visiting.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Below Post Ad