(A) an object is initialized with another object data of the same class when it’s created
(B) n object is initialized with another object of any class when it’s created
(C) an object is initialized with a variable of a basic type when it’s created
(D) an object is not initialized when it’s created
Category: Introduction to Programming Mcqs
Introduction to Programming Mcqs for Screening tests, Interviews, Viva and Other competitive exams. Programming Mcqs section will help users to prepare mcqs of programming languages for various exams. Aspirants of Lecturer Computer Science, SST Computer Science, Subject Specialist Computer Science, Data Entry operator, Computer Programmer, Computer Operator, Software engineer and all other Competitive Exams can prepare their computer programming portion from here.
To access the 8th element of an int array named myArray of 15 elements, you would write?
(A) int[8]
(B) int[7]
(C) myArray[7]
(D) myArray[8]
A copy constructor?
(A) creates an object initialized with the same data as an existing object
(B) creates a new object that later may be assigned the data of an existing object
(C) creates a new object that later may be assigned the data of an existing object
(D) takes an arbitrary number of arguments
There is a class Student, Which one of the following is a valid destructor for this class?
(A) Student();
(B) Student(int);
(C) ~ Student();
(D) ~ Student(int);
If we open a file stream myfile for reading, what will give us the current position of the file pointer?
(A) tellg()
(B) tellp()
(C) seekg()
(D) seekp()
The new operator?
(A) is used to declare objects or variables
(B) can not create and initialize an object
(C) can allocate an appropriate amount of memory for an object or variable
(D) returns an address to an object or variable
A friend function of a class has access?
(A) To all data member and functions of the class
(B) Only to other friend functions of the class
(C) Only to private data of the class
(D) Only to public data of the class
When we write a class template the first line must be:
(A) template < class class_type>
(B) template < class data_type>
(C) template < class T >, Here T can be replaced with any name but it is preferable.
(D) class class-name()