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.
Questions
Which data type is in C++ but not in C?
- Int
- Char
- Bool
- Double
Which of the following represents correct declaration of sprintf function in C?
- Int sprintf ( char * str, const char * format)
- Void sprintf ( char * str, const char * format, ...)
- Int sprintf ( int, const char * format, ... )
- Int sprintf ( char * str, const char * format, ... )
Which of these is not a standard C/C++ function?
- Atoi
- Itoa
- sprintf
- printf
Which type of access structure member in C++ is by default?
- Private
- Public
- Default
- Protected
Why does not the following statement work?
char temp[] = Hurry; strcat(temp,'!');
- There is no problem in the above statement.
- Because the second argument is a character.
- Because the first argument is of type char*.
- The strcat declaration also takes length of string as an argument.
How can we create an abstract class in C++?
- By defining virtual functions in class
- By defining pure virtual functions in class
- By defining virtual destructor
- By defining virtual constructor
What is the maximum value that an 'unsigned short int' can hold?
- 32767
- - 32767
- 65535
- 0
The macro EXIT_SUCCESS is defined in ___________header in standard C++.
- The,cstdio
- The.cstring
- The,cstdlib
- The,iostream
Which parameter is added to every non-static member function of class?
- The virtual
- The public
- The final
- This pointer
C is often called as
- high level language
- assembly level language
- machine level language
- middle level language
Which of the following data types is not defined by C?
- Char
- Int
- Bool
- Double
Which of the following is not calling the copy constructor of class given below?
Class Test
{
public:
Test(int i );
};
- Test Obj2(Obj1);
- Test Obj2 = Obj1;
- Test Obj1,Obj2;Obj2 = Obj1;
- None of these
Which of the following functions is not defined in string.h?
- strcmp
- strlen
- strcat
- pow
Which of the following does not fall under the category of systems program?
- Operating system
- Device drivers
- Microsoft word
- Compilers
In which of the following headers files is FOPEN_MAX macro defined?
- math.h
- stdlib.h
- stdio.h
- string.h
If we declare integer array with dimensions 10, 5; how many bytes will be allocated for it in memory for a 32-bit machine?
- 100 bytes
- 200 bytes
- 300 bytes
- 400 bytes
Which of the following is not a storage class specifier?
- Extern
- Auto
- Register
- Volatile
Which of the following functions is defined in ctype.h?
- Exit
- strcmp
- Tolower
- Gets
Who invented C++?
- Dennis Ritchie
- Ken Thompson
- Bill Gates
- Bjarne Stroustrup
Which of the following is a structured language?
- Dot Net
- C++
- Java
- C