Home / MCQ Bank / Computer
Computer Arrays And Strings In C Plus Plus

What is the correct way to access the last element of an array named arr in C++?

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option D • arr[size - 1]

Related Computer Questions

What is the primary use of the leaflet package in R? What will be the new value of x in the following C++ code? #include <iostream> using namespace std; void fun(int &x) { x = 20; } int main() { int x = 10; fun(x); cout << "New value of x is " << x; return 0; } Which of these is also known as a virtual table? In a one-to-many relationship, the entity that is on the one side of the relationship is called a(n) ________ entity. What will be the output of the following Java program? import java.util.*; class Output { public static double sumOfList(List<? extends Number> list) { double s = 0.0; for (Number n : list) s += n.doubleValue(); return s; } public static void main(String args[]) { List<Double> ld = Arrays.asList(1.2, 2.3, 3.5); System.out.println(sumOfList(ld)); } }