Question

Which of the following commands displays the string ‘Enter a value for D ‘ and then...

Which of the following commands displays the string ‘Enter a value for D ‘ and then waits for the user to enter a number and then assigns that number to the variable D?

  • A. D=enter(‘Enter a value for D ‘)
  • B. input(D=,‘Enter a value for D ‘)
  • C. D=input(‘Enter a value for D ‘)
  • D. enter(D=,‘Enter a value for D ‘)
  • E. None of the above

What is MATLAB’s response to the following command: a=(4*2==16/2)+3

  • A. a=0
  • B. a=1
  • C. a=2
  • D. a=4
  • E. a=8

What is MATLAB’s response to the following command: a=3*8/4>=(2+6)/4

  • A. a=0
  • B. a=1
  • C. a=4
  • D. a=12
  • E. a=24
0 0
Add a comment Improve this question Transcribed image text
Answer #1
Question 1:
C. D=input(‘Enter a value for D ‘)

Question 2:
a=(4*2==16/2)+3
a=(8==16/2)+3
a=(8==8)+3
a=(true)+3
[Note: true is logically equals to 1]
a=(1)+3
a=4
Answer:
D. a=4

Question 3:
a=3*8/4>=(2+6)/4
a=3*8/4>=(8)/4
a=24/4>=(8)/4
a=6>=(8)/4
[Note >= is less priority than /]
a=6>=2
a=true
[Note: true is logically equals to 1]
a=1
Answer:
B. a=1

Question 1:
C. D=input(‘Enter a value for D ‘)

Question 2:
D. a=4

Question 3:
B. a=1

Note: Check operator precedence (BODMAS rules) to know priority of operators

Add a comment
Know the answer?
Add Answer to:
Which of the following commands displays the string ‘Enter a value for D ‘ and then...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that prompts the user to enter a binary string and displays the corresponding...

    Write a program that prompts the user to enter a binary string and displays the corresponding decimal integer value. For example, binary string ‘10001’ is 17 (1*24 +0*23 +0*22 +0*2 + 1 = 17) A sample run : Enter a binary: 10001 17 Enter second integer: 110 6 Use python.

  • Python: Write a program that lets the user enter a string and displays the letter that...

    Python: Write a program that lets the user enter a string and displays the letter that appears most frequently in the string, ignore spaces, punctuation, and Upper vs Lower case. Create a list to hold letters based on the length of the user input Convert all letters to the same case Use a loop to check for each letter in the alphabet Have a variable to hold the largest number of times a letter appears, and replace the value when...

  • (Process a string) Write a program that prompts the user to enter a string and displays...

    (Process a string) Write a program that prompts the user to enter a string and displays its length and its first character. java StringLength Enter a string:Does quantum determinacy have anything to with whether human cognition is deterministic? The string is of length 88 and the first character is D import java.util.Scanner; class StringLength{    public static void main (String args[]){        Scanner input = new Scanner(System.in);        System.out.println("Enter a string:");        String ans = input.nextLine();        System.out.println("The string...

  • 1.Which of the following Linux scripting commands would be used to access the single command-line parameter...

    1.Which of the following Linux scripting commands would be used to access the single command-line parameter that a user has typed on the command-line? Group of answer choices A) $0 B) $# C) $$ D) $* E) $1 2. If I type the command “update my local Internet settings” (without the quotes) at the Linux command-line, from within the running script which of the following variables would the word “Internet” be stored in, if the script gets run correctly? Group...

  • Complete the code The instructions to a turtle can be encoded in a string. Complete Asn4_5 as fo...

    complete the code The instructions to a turtle can be encoded in a string. Complete Asn4_5 as follows: In main() the user will be prompted to enter instructions to a turtle as follows. The instructions will be entered in a loop that will end when the user enters quit or Quit at the first prompt. The first prompt will ask for a color. If the user enters quit or the user enters Quit the program will exit. The second prompt...

  • Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices...

    Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices and vectors in MATLAB [ 2 -6 3 ] [ 5 ] -3 A= 2 -7 -2 , B= 2 -2 -3 , b= -13 , c= 3 -1 4], d= 0 [ 7 -2 7 [1 -8 -1 ] [ 10 (a) Perform the following operations: AB, BA, CA and Bd (use standard linear algebra multiplication). - 3 (b) Construct a 6 x...

  • Write a C program that parses a string (command line) and tokenize it by breaking the...

    Write a C program that parses a string (command line) and tokenize it by breaking the string characters into words that are separated by delimiters that can be white spaces (space and/or tab characters). It also must report how many commands in the input. This program will be reused for your next C programming assignment that is a simple shell interpreter/program called "tech shell". % a.out please enter a string: this is a test 1: this 2: is 3: a...

  • Write a program that prompts the user to enter the number of milliseconds and converts the milliseconds to a string hours:minutes:seconds

    Problem 1.Write a program that prompts the user to enter the number of milliseconds and converts the milliseconds to a string hours:minutes:seconds. The program should use the convertMillismethod with the following header:public static String convertMillis(long millis)For example, convertMillis(5500) returns the string 0:0:5, convertMillis(100000) returns the string 0:1:40, andconvertMillis(555550000) returns the string154:19:10.Problem 2. (Count occurrence of numbers)Write a program that reads integers between 1 and 100 and counts the occurrence of each (you should store the numbers in an array). Output...

  • Task 2 Description and Example: Network DOS Tools For each of the DOS network commands listed,...

    Task 2 Description and Example: Network DOS Tools For each of the DOS network commands listed, do the following: Describe what the command does Use the command and show the results. DOS Network Commands 1. arp 2. hostname 3. pathping 4. nslookup. Example: Finger Description - Displays information about a user or users on a specified remote computer typically a computer running UNIX) that is running the Finger service or daemon. The remote computer specifies the format and output of...

  • a.) Which of the following commands lists active network devices when executed with no arguments? ifconfig...

    a.) Which of the following commands lists active network devices when executed with no arguments? ifconfig nmcli ifdown ifup b.) Some Linux distributions include __________, an automated tool that configures network settings without any interaction on your part. ESSID Network Manager WPA ARP c.) Which of the following is not true regarding the ip command? The ip command is no longer under development. The ip command is designed to replace the ifconfig, arp, and route commands. If you inherit an...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT