Basics Of C++ Language: MCQs On C++ Language Basics

Basics Of C++ Language. MCQs related to the Basics Of C++ Language.

Basics Of C++ Language

What are the formal parameters in C++ ??

a) Parameters with which functions are called
b) Parameters that are used in the definition of the function
c) Variables other than passed parameters in a function
d) Variables that are never used in the function

 

What are the actual parameters in C++ ??

a) Parameters with which functions are called
b) Parameters that are used in the definition of a function
c) Variables other than passed parameters in a function
d) Variables that are never used in the function

 

A language that has the capability to generate new data types is called ??

a) Extensible
b) Overloaded
c) Encapsulated
d) Reprehensible

 

Which of the following is used for comments in C++ ??

a) // comment
b) /* comment */
c) both // comment or /* comment */
d) // comment */

Basics Of C++ Language

Which of the following is called address operator ??

a) *
b) &
c) _
d) %

 

Which of the following type is provided by C++ but not C ??

a) int
b) bool
c) float
d) double

 

What happens if the following program is executed in C and C++ ??

#include <stdio.h>
void func()
{
printf(“Hello”);
}
void main()
{
func();
func(2);
}

a) Error in both C and C++
b) Outputs Hello twice in both C and C++
c) Error in C and Outputs Hello twice in C++
d) Error in C++ and Outputs Hello twice in C

 

What happens if the following program is executed in C and C++ ??

#include <stdio.h>
void func(void)
{
printf(“Hello”);
}
void main()
{
func();
func(2);
}

a) Error in both C and C++
b) Outputs Hello twice in both C and C++
c) Error in C and successful execution in C++
d) Error in C++ and successful execution in C

Basics Of C++ Language

What happens if the following line is executed in C and C++ ??

const int a;

a) Error in both C and C++
b) Warning in both C and C++
c) Error in C and successful execution in C++
d) Error in C++ and successful execution in C

 

What happens if the following program is executed in C and C++ ??

#include <stdio.h>
void main()
{
printf(“Hello World”);
}

a) Error in both C and C++
b) Successful run in both C and C++
c) Error in C and successful execution in C++
d) Error in C++ and successful execution in C

 

What happens if the following program is executed in C and C++ ??

#include <stdio.h>
int main(void)
{
int new = 5;
printf(“%d”, new);
}

a) Error in both C and C++
b) A successful run in both C and C++
c) Error in C and successful execution in C++
d) Error in C++ and successful execution in C

 

What happens if the following line is executed in C and C++ ??

int *p = malloc(10);

a) Error in both C and C++
b) Warning in both C and C++
c) Error in C++ and successful execution in C
d) Error in C and successful execution in C++

Basics Of C++ Language

What happens if the following program is executed in C and C++ ??

#include <stdio.h>
int main(void)
{
const int j = 20;
int *ptr = &j;
printf(“*ptr: %d\n”, *ptr);
return 0;
}

a) Error in both C and C++
b) Warning in both C and C++
c) Error in C but Warning in C++
d) Error in C++ but Warning in C

 

What happens if the following program is executed in C and C++ ??

#include<stdio.h>
int main()
{
foo();
}
int foo()
{
printf(“Hello”);
return 0;
}

a) Error in both C and C++
b) Warning in both C and C++
c) Error in C++ but Warning in C
d) Error in C but Warning in C++

 

What are classes in C++ ??

a) derived data types
b) User-defined data types
c) built-in data types
d) All of these

 

More Posts

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!