Knowee
Questions
Features
Study Tools

The number of bytes occupied by a character array of 10 elements.(a) 20 bytes(b) 60 bytes(c) 40 bytes(d) 120 bytes(vi) The method of Scanner class used to accept a double value is:(a) nextInt()(b) nextDouble()(c) next()(d) nextInteger()

Question

The number of bytes occupied by a character array of 10 elements.(a) 20 bytes(b) 60 bytes(c) 40 bytes(d) 120 bytes(vi) The method of Scanner class used to accept a double value is:(a) nextInt()(b) nextDouble()(c) next()(d) nextInteger()

🧐 Not the exact question you are looking for?Go ask a question

Solution

  1. The number of bytes occupied by a character array of 10 elements depends on the character encoding used. In most systems, a character is represented using 2 bytes (for UTF-16 encoding). Therefore, a character array of 10 elements would occupy 2*10 = 20 bytes. So, the answer is (a) 20 bytes.

  2. The method of Scanner class used to accept a double value in Java is nextDouble(). So, the answer is (b) nextDouble().

This problem has been solved

Similar Questions

The number of bytes occupied by a character array of 10 elements.(a) 20 bytes(b) 60 bytes(c) 40 bytes(d) 120 bytes

A double array requires 8 bytes per element. The functions ones, zeros, and randn all create double arrays

import java.util.Scanner;public class Question64{ public static void main(String[] args) { double sum = 0.0; double standardDeviation = 0.0; double mean = 0.0; double res = 0.0; double sq = 0.0; Scanner sc = new Scanner(System.in); int num = sc.nextInt(); double arr[] = new double[num]; for (int i = 0; i < num; i++) { arr[i] = sc.nextDouble(); }

Interpret where the elements of an array LA are stored, if the base address of LA is 320 & LB =0Assume that int(s) are stored in 4 bytes and double(s) in 8 bytes.a. double LA[12]

Analise o código a seguir:import java.util.Scanner;public class SalarioVendedor {    public static main(String[] args) {        Scanner scanner = new Scanner(System.in);        System.out.print("Digite o nome do vendedor: ");        String nome = scanner.nextLine();        System.out.print("Digite o salário base do vendedor: ");        double salarioBase = scanner.nextDouble();        System.out.print("Digite o total de vendas do mês: ");        double totalVendas = scanner.nextdouble();        double salarioTotal = salarioBase + (totalVendas * 0.05);        System.out.println("O salário total de " + nome + " é: R$" + salarioTotal);    }}Quais as duas linhas com erro de sintaxe no código acima?Questão 4Escolha uma opção:a.1 e 6b.10 e 11c.8 e 11d.3 e 10

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.