CARVIEW |
Select Language
HTTP/2 200
content-type: text/html; charset=utf-8
date: Wed, 30 Jul 2025 18:09:49 GMT
permissions-policy: interest-cohort=()
strict-transport-security: max-age=31536000; includeSubDomains
server: nginx
cache-control: s-maxage=53602, max-age=0
x-powered-by: Next.js
etag: "182z7onn7q6aj36"
content-encoding: gzip
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'self' http: https: ws: wss: data: blob: 'unsafe-eval' 'unsafe-inline'; frame-ancestors 'self';
vary: Accept-Encoding
x-cache: Hit from cloudfront
via: 1.1 97a056e5864490946f8a4e70acc85786.cloudfront.net (CloudFront)
x-amz-cf-pop: BOM78-P9
x-amz-cf-id: CjdVbhcLRrwo87DYWkBAZa3-5jWuFU21vGO5ztZAr-EvHFszwfC5Sg==
age: 18537
Data Structures | Array | Question 2
C++
Java
Interview Preparation
- Interview Preparation For Software Developers
- Must Coding Questions - Company-wise
- Must Do Coding Questions - Topic-wise
- Company-wise Practice Problems
- Company Preparation
- Competitive Programming
- Software Design-Patterns
- Company-wise Interview Experience
- Experienced - Interview Experiences
- Internship - Interview Experiences
Data Structures | Array | Question 2
Last Updated :
Discuss
Comments
What will the output of the below code?
#include <iostream>
using namespace std;
int main()
{
int arr[2] = { 1, 2 };
cout << arr[0] << ", " << arr[1] << endl;
return 0;
}
public class Main {
public static void main(String[] args) {
int[] arr = {1, 2};
System.out.println(arr[0] + ", " + arr[1]);
}
}
1, 2
Syntax error
Run time error
None
This question is part of this quiz :
Top MCQs on Array Data Structure with AnswersTags:
Share your thoughts in the comments

GeeksforGeeks
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy