Q: 1 What is the difference between delete and delete[] in C++?
delete is syntactically correct but delete[] is wrong and hence will give an error if used in any case
delete is used to delete normal object whereas delete[] is used to delete pointer objects
delete is used to delete single object whereas delete[] is used to delete multiple (array/pointer of) objects
More than one of the above
[ Option C ]
In C++, delete and delete[] are used to free dynamically allocated memory, but they serve different purposes.
The delete keyword is used when a single object has been allocated using new. On the other hand, delete[] is used when an array of objects has been allocated using new[].
Q: 2 To implement graphic operation in C++, which header file is needed?
graphics.h
visual.h
pictures.c
iostream.h
[ Option A ]
In C++, graphics operations such as drawing lines, circles, rectangles, and displaying graphics on the screen were traditionally done using the BGI (Borland Graphics Interface) library. For this purpose, the header file graphics.h is used.
Q: 3 The statement cout<<hex<<15; prints?
hex 15
15
f
Error occurred undefined symbol ‘hex’
[ Option C ]
In C++, hex is a formatting manipulator defined in the <iostream> header file. The manipulator hex tells cout to display numbers in hexadecimal format. The number 15 in hexadecimal is represented as f.
Q: 4 What does STL stand for?
Simple Template Library
Standard Template Library
Static Type Library
Single Type-based Library
[ Option B ]
STL stands for Standard Template Library. It is a powerful collection of predefined, generic classes and functions. STL uses the concept of templates, which allows the same code to work with different data types.
It mainly includes containers such as vector, list, and map for storing data, algorithms such as sort and find for processing data, and iterators for traversing through containers.
STL helps programmers write efficient, reusable, and well-structured code, making program development faster and easier.
Q: 5 A set of libraries that provides programmatically access to some kind of graphics 2D function is
Graphics Package
Formatting Package
Animation Package
More than one of the above
[ Option A ]
A graphics package is a set of libraries that provides programming access to 2D graphics functions such as drawing lines, circles, shapes, displaying images, and creating simple visual elements. These libraries allow programmers to write code that can display graphics on the screen.
Graphics Package is the right term for a set of libraries offering programmatic 2D graphics functions.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.