C C /C programming language MCQ Questions Set 3 Sample Test,Sample questions

Question:
0946, 786427373824, ‘x’ and 0X2f are _____ _____ ____ and _____ literals respectively.

1.decimal, character, octal, hexadecimal

2.octal, hexadecimal, character, decimal

3.hexadecimal, octal, decimal, character

4.octal, decimal, character, hexadecimal


Question:
 Choose the right option.  string* x, y;

1.x is a pointer to a string, y is a string

2.y is a pointer to a string, x is a string

3. both x and y are pointers to string types

4.y is a pointer to a string


Question:
Choose the incorrect option.

1.void is used when the function does not return a value

2.void is also used when the value of a pointer is null

3.void is used as the base type for pointers to objects of unknown type

4.void is a special fundamental type


Question:
For what values of the expression is an if-statement block not executed?

1.0 and all negative values

2. 0 and -1

3.0

4.0, all negative values, all positive values except 1


Question:
How are the constants declared?

1.const keyword

2.#define preprocessor

3.both const keyword and #define preprocessor

4.$define


Question:
How do we represent a wide character of the form wchar_t?

1.L’a’

2.l’a’

3.L[a]

4.la


Question:
How many characters are specified in the ASCII scheme?

1.64

2. 128

3.256

4.24


Question:
Identify the incorrect option.

1.1 <= sizeof(bool) <= sizeof(long)

2.sizeof(float) <= sizeof(double) <= sizeof(long double)

3.sizeof(char) <= sizeof(long) <=sizeof(wchar_t)

4.sizeof(N) = sizeof(signed N) = sizeof(unsigned N)


Question:
Identify the incorrect option.

1.enumerators are constants

2. enumerators are user-defined types

3.enumerators are same as macros

4. enumerator values start from 0 by default


Question:
Implementation dependent aspects about an implementation can be found in ____

1.<implementation>

2. <limits>

3.<limit>

4.<numeric>


Question:
In C++, what is the sign of character data type by default?

1.Signed

2.Unsigned

3.Implementation dependent

4.Unsigned Implementation


Question:
In which type do the enumerators are stored by the compiler?

1.string

2.integer

3.float

4. string & float


Question:
Is the size of character literals different in C and C++?

1. Implementation defined

2.Can’t say

3.Yes, they are different

4.No, they are not different


Question:
It is guaranteed that a ____ has at least 8 bits and a ____ has at least 16 bits.

1. int, float

2.char, int

3.bool, char

4. char, short


Question:
Which of the following statements are false?

1.bool can have two values and can be used to express logical expressions

2.bool cannot be used as the type of the result of the function

3.bool can be converted into integers implicitly

4.a bool value can be used in arithmetic expressions


Question:
Size of C++ objects are expressed in terms of multiples of the size of a ____ and the size of a char is ______

1.char, 1

2.int, 1

3. float, 8

4. char, 4


Question:
Suppose in a hypothetical machine, the size of char is 32 bits. What would sizeof(char) return?

1.4

2.1

3.Implementation dependent

4.Machine dependent


Question:
The constants are also called as ________

1.const

2.preprocessor

3.literals

4. variables


Question:
The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is _______

1. int **fun(float**, char**)

2.int *fun(float*, char*)

3. int **fun(float*, char**)

4.int ***fun(*float, **char)


Question:
The size of an object or a type can be determined using which operator?

1.malloc

2. sizeof

3.malloc

4.calloc


Question:
The size_t integer type in C++ is?

1.Unsigned integer of at least 64 bits

2.Signed integer of at least 16 bits

3.Unsigned integer of at least 16 bits

4. Signed integer of at least 64 bits


Question:
To which of these enumerators can be assigned?

1. integer

2.negative

3.enumerator

4.all of the mentioned


Question:
What are the parts of the literal constants?

1.integer numerals

2. floating-point numerals

3. strings and boolean values

4.all of the mentioned


Question:
What constant defined in <climits> header returns the number of bits in a char?

1.CHAR_SIZE

2.SIZE_CHAR

3.BIT_CHAR

4.CHAR_BIT


Question:
What does the following statement mean?  void a;

1.variable a is of type void

2.a is an object of type void

3.declares a variable with value a

4.flags an error


Question:
What does the following statement mean? int (*fp)(char*)

1.pointer to a pointer

2. pointer to an array of chars

3.pointer to function taking a char* argument and returns an int

4.function taking a char* argument and returning a pointer to int


Question:
What is size of generic pointer in C++ (in 32-bit platform)?

1.2

2.4

3.8

4.0


Question:
What is the correct definition of an array?

1.An array is a series of elements of the same type in contiguous memory locations

2.An array is a series of element

3.An array is a series of elements of the same type placed in non-contiguous memory locations

4.An array is an element of the different type


Question:
What is the index number of the last element of an array with 9 elements?

1.9

2.8

3.0

4.Programmer-defined


Question:
What is the meaning of the following declaration? int(*p[5])();

1. p is pointer to function

2. p is array of pointer to function

3.p is pointer to such function which return type is the array

4.p is pointer to array of function


Question:
What is the range of the floating point numbers?

1.-3.4E+38 to +3.4E+38

2.-3.4E+38 to +3.4E+34

3. -3.4E+38 to +3.4E+36

4.-3.4E+38 to +3.4E+32


Question:
What will happen when defining the enumerated type?

1. it will not allocate memory

2. it will allocate memory

3.it will not allocate memory to its variables

4.allocate memory to objects


Question:
Which is correct with respect to the size of the data types?

1.char > int < float

2. int < char > float

3.char < int < float

4.char < int < double


Question:
Which is used to indicate single precision value?

1.F or f

2.L or l

3.Either F or for L or l

4.Neither F or for L or l


Question:
Which of the following accesses the seventh element stored in array?

1.array[6];

2.array[7];

3.array(7);

4. array;


Question:
Which of the following belongs to the set of character types?

1.char

2.wchar_t

3.only a

4.both wchar_t and char


Question:
Which of the following correctly declares an array?

1.int array[10];

2.int array;

3.array{10};

4.array array[10];


Question:
Which of the following gives the memory address of the first element in array?

1.array[0];

2. array[1];

3.array(2);

4.array;


Question:
Which of the following is illegal?

1.int *ip;

2.string s, *sp = 0;

3.int i; double* dp = &i;

4.int *pi = 0;


Question:
Which of the following is not one of the sizes of the floating point types?

1.short float

2.float

3.long double

4.double


Question:
Which of the following will not return a value?

1.null

2.void

3.empty

4.free


Question:
Which of the two operators ++ and — work for the bool data type in C++?

1. None

2. ++

3.—

4.++ & —


Question:
Which of these expressions will isolate the rightmost set bit?

1.x = x & (~x)

2.x = x ^ (~x)

3.x = x & (-x)

4. x = x ^ (-x)


Question:
Which of these expressions will make the rightmost set bit zero in an input integer x?

1. x = x | (x-1)

2.x = x & (x-1)

3.x = x | (x+1)

4.x = x & (x+2)


Question:
Which of these expressions will return true if the input integer v is a power of two?

1.(v | (v + 1)) == 0;

2.(~v & (v – 1)) == 0;

3.(v | (v – 1)) == 0;

4.(v & (v – 1)) == 0;


Question:
Which of three sizes of floating point types should be used when extended precision is required?

1.float

2.double

3.long double

4.extended float


Question:
Which one of the following is not a possible state for a pointer.

1.hold the address of the specific object

2. point one past the end of an object

3.zero

4.point to a type


Question:
Which variable does equals in size with enum variable?

1.int variable

2. float variable

3.string variable

4.float & string variable


Question:
__________ have the return type void.

1.all functions

2.constructors

3.destructors

4.none of the mentioned


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
  24. C MCQS:-The ABC of C
  25. C MCQS Interview Questions
  26. C++ Questions and Answers OOPs Basic Concepts
  27. C++ Questions and Answers Returning Objects
  28. C Programming MCQ Part 1
  29. C Programming MCQ
  30. Computer Science & Engineering C Multiple Choice Questions set 1
  31. Computer Science & Engineering C Multiple Choice Questions set 2
  32. C Multiple Choice Questions C Functions Set 1
  33. C Multiple Choice Questions C Functions Set 2
  34. C Multiple Choice Questions C Operators
  35. C Multiple Choice Questions & AnswersConditional Expressions
  36. C Multiple Choice Questions & Answers Data Types
  37. C Multiple Choice Questions & Answers File Access
  38. Computer Science & Engineering Cloud Computing MCQs Part 1
  39. CPP Programming MCQ Set 1
  40. CPP Programming MCQ Set 2
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!