Answer:
Check the explanation
Explanation:
.data
prompt: .asciiz "Please enter your string :"
result_str: .asciiz "\nYour captalized string :"
error_prompt: .asciiz "\nInvalid Entry !"
buffer: .space 20
.text
.globl __start
__start:
ASKING_STR:
la $a0,prompt
li $v0,4
syscall
li $v0,8 #take in input
la $a0, buffer #load byte space into address
li $a1, 20 # allot the byte space for string
move $t0,$a0 #save string to t0
syscall
li $v0, 4
li $t0, 0
loop:
lb $t1, buffer($t0)
beq $t1, 0, exit
slti $t2,$t1,91
bne $t2,$0,UPPER_CHECK
slti $t2,$t1,123
bne $t2,$0,LOWER_TO_UPPER
UPPER_CHECK:
slti $t2,$t1,65
bne $t2,$0,INVALID_ENTRY
slti $t2,$t1,90
bne $t2,$0,NEXT
j INVALID_ENTRY
LOWER_TO_UPPER:
sub $t1, $t1, 32
sb $t1, buffer($t0)
NEXT:
addi $t0, $t0, 1
j loop
INVALID_ENTRY:
li $v0, 4
la $a0, error_prompt
syscall
j ASKING_STR
exit:
li $v0, 4
la $a0, result_str
syscall
li $v0, 4
la $a0, buffer
syscall
li $v0, 10
syscall
Answer:
There is nothing to select you did not add any options
Explanation:
B. FILE PAGES
I answered wrong the first time, but according to an exam the answer is B. Definitely trust an exam answer!
Answer:
Option (d) outfile.write();
Explanation:
As the object created for the class BufferedWriter is outfile, outfile.write is the correct syntax for writing in a text file. Here, write is the method used for writing into a text file. The data present is written in the textfile. Here, the text file is opened before writing the text into the file. Option (d) is correct.
Option (a) outfile.newLine(); is used to separate the lines. This is used to break the existing lines into smaller lines. This can also be used to start a new line. Here, newLine() is the method.So, option (a) is not suitable.
Option (b) outfile.existLine(); This is not a valid syntax as there is no method called existLine() in the class BufferedWriter. So, this is a wrong option.
Option (c) Write(outfile); This is not a valid syntax for writing in a text file. This is a wrong option.