Back-End Programming Exam  >  Back-End Programming Tests  >  Learn to Program with C++: Beginner to Expert  >  Test: Class And Objects - 1 - Back-End Programming MCQ

Test: Class And Objects - 1 - Back-End Programming MCQ


Test Description

10 Questions MCQ Test Learn to Program with C++: Beginner to Expert - Test: Class And Objects - 1

Test: Class And Objects - 1 for Back-End Programming 2024 is part of Learn to Program with C++: Beginner to Expert preparation. The Test: Class And Objects - 1 questions and answers have been prepared according to the Back-End Programming exam syllabus.The Test: Class And Objects - 1 MCQs are made for Back-End Programming 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Class And Objects - 1 below.
Solutions of Test: Class And Objects - 1 questions in English are available as part of our Learn to Program with C++: Beginner to Expert for Back-End Programming & Test: Class And Objects - 1 solutions in Hindi for Learn to Program with C++: Beginner to Expert course. Download more important topics, notes, lectures and mock test series for Back-End Programming Exam by signing up for free. Attempt Test: Class And Objects - 1 | 10 questions in 20 minutes | Mock test for Back-End Programming preparation | Free important questions MCQ to study Learn to Program with C++: Beginner to Expert for Back-End Programming Exam | Download free PDF with solutions
Test: Class And Objects - 1 - Question 1

What does your class can hold?

Detailed Solution for Test: Class And Objects - 1 - Question 1

The classes in c++ are used to manipulate both data and functions.

Test: Class And Objects - 1 - Question 2

Predict the output of following C++ program

#include<iostream>
using namespace std;
  
class Empty {};
  
int main()
{
  cout << sizeof(Empty);
  return 0;
}

Detailed Solution for Test: Class And Objects - 1 - Question 2

#include<iostream>
using namespace std;
  
class Empty {};
  
int main()
{
  cout << sizeof(Empty);
  return 0;
}
Output : 1

Size of an empty class is not zero. It is 1 byte generally. It is nonzero to ensure that the two different objects will have different addresses. 

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: Class And Objects - 1 - Question 3

How many kinds of classes are there in c++?

Detailed Solution for Test: Class And Objects - 1 - Question 3

There are two kinds of classes in c++. They are absolute class and concrete class.

Test: Class And Objects - 1 - Question 4

Which of the following is true?

Detailed Solution for Test: Class And Objects - 1 - Question 4

Every object maintains a copy of non-static data members. For example, let Student be a class with data members as name, year, batch. Every object of student will have its own name, year and batch. On a side note, static data members are shared among objects.
All objects share codes of all methods. For example, every student object uses same logic to find out grades or any other method.

Test: Class And Objects - 1 - Question 5

 Which other keywords are also used to declare the class other than class?

Detailed Solution for Test: Class And Objects - 1 - Question 5

Struct and union take the same definition of class but differs in the access techniques.

Test: Class And Objects - 1 - Question 6

Which of the following is true about the following program

#include <iostream>
class Test
{
public:
    int i;
    void get();
};
void Test::get()
{
    std::cout << "Enter the value of i: ";
    std::cin >> i;
}
Test t;  // Global object
int main()
{
    Test t;  // local object
    t.get();
    std::cout << "value of i in local t: "<<t.i<<'n';
    ::t.get(); 
    std::cout << "value of i in global t: "<<::t.i<<'n';
    return 0;
}

Detailed Solution for Test: Class And Objects - 1 - Question 6

The above program compiles & runs fine. Like variables it is possible to create 2 objects having same name & in different scope.

Test: Class And Objects - 1 - Question 7

The fields in the class in c++ program are by default

Test: Class And Objects - 1 - Question 8

Which of the following is not correct for virtual function in C++ ?

Detailed Solution for Test: Class And Objects - 1 - Question 8

Virtual function is can’t be static in C++. So, option (B) is correct.

Test: Class And Objects - 1 - Question 9

When struct is used instead of the keyword class means, what will happen in the program?

Test: Class And Objects - 1 - Question 10

Which of the following cannot be passed to a function in C++ ?

Detailed Solution for Test: Class And Objects - 1 - Question 10

Header file can not be passed to a function in C++. While array, constant and structure can be passed into a function.
So, option (D) is correct.

73 videos|7 docs|23 tests
Information about Test: Class And Objects - 1 Page
In this test you can find the Exam questions for Test: Class And Objects - 1 solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Class And Objects - 1, EduRev gives you an ample number of Online tests for practice
Download as PDF