C/C++ Programming Fundamentals

Test your knowledge of fundamental C and C++ programming concepts including data types, functions, access specifiers, string handling, OOP concepts, memory allocation, and standard library functions.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which data type is in C++ but not in C?

  1. Int
  2. Char
  3. Bool
  4. Double
Question 2 Multiple Choice (Single Answer)

Which of the following represents correct declaration of sprintf function in C?

  1. Int sprintf ( char * str, const char * format)
  2. Void sprintf ( char * str, const char * format, ...)
  3. Int sprintf ( int, const char * format, ... )
  4. Int sprintf ( char * str, const char * format, ... )
Question 3 Multiple Choice (Single Answer)

Which of these is not a standard C/C++ function?

  1. Atoi
  2. Itoa
  3. sprintf
  4. printf
Question 4 Multiple Choice (Single Answer)

Which type of access structure member in C++ is by default?

  1. Private
  2. Public
  3. Default
  4. Protected
Question 5 Multiple Choice (Single Answer)

Why does not the following statement work?

char temp[] = Hurry; strcat(temp,'!');

  1. There is no problem in the above statement.
  2. Because the second argument is a character.
  3. Because the first argument is of type char*.
  4. The strcat declaration also takes length of string as an argument.
Question 6 Multiple Choice (Single Answer)

How can we create an abstract class in C++?

  1. By defining virtual functions in class
  2. By defining pure virtual functions in class
  3. By defining virtual destructor
  4. By defining virtual constructor
Question 7 Multiple Choice (Single Answer)

What is the maximum value that an 'unsigned short int' can hold?

  1. 32767
  2. - 32767
  3. 65535
  4. 0
Question 8 Multiple Choice (Single Answer)

The macro EXIT_SUCCESS is defined in ___________header in standard C++.

  1. The,cstdio
  2. The.cstring
  3. The,cstdlib
  4. The,iostream
Question 9 Multiple Choice (Single Answer)

Which parameter is added to every non-static member function of class?

  1. The virtual
  2. The public
  3. The final
  4. This pointer
Question 10 Multiple Choice (Single Answer)

C is often called as

  1. high level language
  2. assembly level language
  3. machine level language
  4. middle level language
Question 11 Multiple Choice (Single Answer)

Which of the following data types is not defined by C?

  1. Char
  2. Int
  3. Bool
  4. Double
Question 12 Multiple Choice (Single Answer)

Which of the following is not calling the copy constructor of class given below?

Class Test
{
public:
Test(int i );
};

  1. Test Obj2(Obj1);
  2. Test Obj2 = Obj1;
  3. Test Obj1,Obj2;Obj2 = Obj1;
  4. None of these
Question 13 Multiple Choice (Single Answer)

Which of the following functions is not defined in string.h?

  1. strcmp
  2. strlen
  3. strcat
  4. pow
Question 14 Multiple Choice (Single Answer)

Which of the following does not fall under the category of systems program?

  1. Operating system
  2. Device drivers
  3. Microsoft word
  4. Compilers
Question 15 Multiple Choice (Single Answer)

In which of the following headers files is FOPEN_MAX macro defined?

  1. math.h
  2. stdlib.h
  3. stdio.h
  4. string.h
Question 16 Multiple Choice (Single Answer)

If we declare integer array with dimensions 10, 5; how many bytes will be allocated for it in memory for a 32-bit machine?

  1. 100 bytes
  2. 200 bytes
  3. 300 bytes
  4. 400 bytes
Question 17 Multiple Choice (Single Answer)

Which of the following is not a storage class specifier?

  1. Extern
  2. Auto
  3. Register
  4. Volatile
Question 18 Multiple Choice (Single Answer)

Which of the following functions is defined in ctype.h?

  1. Exit
  2. strcmp
  3. Tolower
  4. Gets
Question 19 Multiple Choice (Single Answer)

Who invented C++?

  1. Dennis Ritchie
  2. Ken Thompson
  3. Bill Gates
  4. Bjarne Stroustrup
Question 20 Multiple Choice (Single Answer)

Which of the following is a structured language?

  1. Dot Net
  2. C++
  3. Java
  4. C