2024年最新のに更新された検証済みのCLA-11-03問題集と解答で合格保証もしくは全額返金 [Q13-Q37]

Share

2024年最新のに更新された検証済みのCLA-11-03問題集と解答で合格保証もしくは全額返金

CLA-11-03のPDF問題とテストエンジンには41問があります

質問 # 13
What happens if you try to compile and run this program?
#include <stdio.h>
int main (int argc, char *argv[]) {
int i = 20;
printf("%x", i);
return 0;
}
-
Choose the right answer:

  • A. The program outputs 14
  • B. Compilation fails
  • C. The program outputs 20
  • D. The program outputs 10
  • E. The program outputs 24

正解:A

解説:
The program outputs 14 because the printf function prints the value of i as a hexadecimal integer using the %x format specifier. The hexadecimal system uses 16 symbols to represent numbers, from 0 to 9 and from A to F.
Each symbol corresponds to a decimal value, for example, A is 10, B is 11, C is 12, and so on. To convert a decimal number to a hexadecimal number, we need to divide the number by 16 repeatedly and write down the remainder in reverse order. For example, to convert 20 to hexa-decimal, we do:
20 / 16 = 1, remainder 4 1 / 16 = 0, remainder 1
The hexadecimal number is 14, as we write the remainders from right to left.
References = CLA - C Certified Associate Programmer Certification, C Essentials 2 - (Intermediate), C printf and scanf functions, Hexadecimal number system


質問 # 14
Assume that we can open a file called "file1".
What happens when you try to compile and run the following program?
#include <stdio.h>
int main (void) {
FILE *f;
int i;
f = fopen("file1","wb");
fputs("545454",f);
fclose (f);
f = fopen("file1","rt");
fscanf(f,"%d ", &i);
fclose (f) ;
printf("%d",i);
return 0;
}
Choose the right answer:

  • A. The program outputs 0
  • B. Execution fails
  • C. Compilation fails
  • D. The program outputs 545454
  • E. The program outputs 54

正解:D

解説:
The program outputs 545454 because the fputs function writes the string "545454" to the file "file1" in binary mode, and the fscanf function reads the string as an integer from the file in text mode. The binary mode and the text mode are different ways of interpreting the data in a file. In binary mode, the data is stored as a sequence of bytes, and no translation is performed. In text mode, the data is stored as a sequence of characters, and some characters may be translated depending on the plat-form. For example, the newline character may be translated to a carriage return and a line feed on Windows, or just a line feed on Linux. The fopen function takes a mode argument that specifies whether the file should be opened in binary or text mode. The mode
"wb" means write binary, and the mode "rt" means read text.
When the fputs function writes the string "545454" to the file in binary mode, it writes the ASCII val-ues of each character as a byte. The ASCII value of '5' is 53, and the ASCII value of '4' is 52. There-fore, the file contains the following bytes: 53 53 53 52 52 52. When the fscanf function reads the file in text mode, it interprets the bytes as characters and converts them to an integer using the %d format specifier. The %d format specifier expects a decimal integer, which is a number com-posed of digits from 0 to 9. Since the file contains only digits, the fscanf function successfully con-verts the string "545454" to an integer with the same value.
The printf function then prints the value of i as a decimal integer using the %d format specifier.
References = CLA - C Certified Associate Programmer Certification, C Essentials 2 - (Intermediate), C File I/O, ASCII Table


質問 # 15
What happens if you try to compile and run this program?
#include <stdio.h>
int main (int argc, char *argv[]) {
int main, Main, mAIN = 1;
Main = main = mAIN += 1;
printf ("%d", MaIn) ;
return 0;
}
Choose the right answer:

  • A. The program outputs 3
  • B. The program outputs 1
  • C. Compilation fails
  • D. The program outputs 2
  • E. The program outputs an unpredictable value

正解:C

解説:
The program is not a valid C program and cannot be compiled successfully. The reason is that the program uses the same name main for both a function and a variable, which is not allowed in C. The name main is a reserved keyword that denotes the entry point of the program, and it cannot be redefined or reused for any other purpose. Therefore, the compiler will report an error and the program will not run. References = C - main() function - Tutorialspoint, C Keywords - GeeksforGeeks, C Basic Syntax


質問 # 16
What happens if you try to compile and run this program?
#include <stdio.h>
int fun(int i) {
return i++;
}
int main (void) {
int i = 1;
i = fun(i);
printf("%d",i);
return 0;
}
Choose the correct answer:

  • A. The program outputs 0
  • B. Compilation fails
  • C. The program outputs 2
  • D. The program outputs 1
  • E. The program outputs an unpredictable value

正解:D

解説:
In the fun function:
cCopy code
int fun(int i) { return i++; }
The post-increment operator i++ returns the current value of i and then increments it. So, fun(i) will return the current value of i (which is 1) and then increment i to 2.
In the main function:
cCopy code
int i = 1; i = fun(i); printf("%d", i);
Here, i is assigned the result of fun(i), which is 1. So, the program prints the value of i, which is 1.
Therefore, the correct answer is D. The program outputs 1.


質問 # 17
What happens if you try to compile and run this program?
#include <stdio.h>
int main(int argc, char *argv[]) {
int i = 10 - 2 / 5 * 10 / 2 - 1;
printf("%d",i);
return 0;
}
Choose the right answer:

  • A. The program outputs 15
  • B. The program outputs 0
  • C. Compilation fails
  • D. The program outputs 4
  • E. The program outputs 9

正解:E

解説:
The expression 10 - 2 / 5 * 10 / 2 - 1 is evaluated based on the standard precedence rules in C. Division and multiplication have higher precedence than addition and subtrac-tion, and they are evaluated from left to right:
1.2 / 5 evaluates to 0 (integer division).
2.0 * 10 evaluates to 0.
3.0 / 2 evaluates to 0.
4.10 - 0 - 1 evaluates to 9.
Therefore, the correct answer is "The program outputs 9."


質問 # 18
What happens if you try to compile and run this program?
#include <stdio.h>
int main (int argc, char *argv[]) {
char *p = "World";
int i = 2;
switch (p[i]) {
case 'W' :i++; break ;
case 'o' :i += 2; break ;
case 'r' :i += 3; break ;
case '1' :i += 4; break ;
case 'd' :i += 5; break ;
default :i += 4;
}
printf("%d", i);
return 0;
}
-
Choose the right answer:

  • A. The program outputs 3
  • B. Compilation fails
  • C. The program outputs 5
  • D. The program outputs 6
  • E. The program outputs 4

正解:C

解説:
*The program defines a pointer p that points to the string literal "World".
*The program also defines an integer variable i and assigns it the value 2.
*The program uses a switch statement to check the value of p[i], which is the third character of the string
"World", i.e. 'r'.
*The program finds a matching case for 'r' and executes the statement i += 3;, which adds 3 to the value of i.
Then it breaks out of the switch statement.
*The program prints the value of i, which is now 5, using the printf function.
*The program returns 0 and exits.


質問 # 19
What happens if you try to compile and run this program?
#include <stdio.h>
int main (int argc, char *argv[]) {
int i = 1, j = 0;
int 1 = !i + !! j;
printf("%d", 1);
return 0;
}
Choose the right answer:

  • A. The program outputs 3
  • B. The program outputs 1
  • C. The program outputs 0
  • D. Compilation fails
  • E. The program outputs 2

正解:D

解説:
The compilation fails because the program contains a syntax error. The identifier 1 is not a valid name for a variable, as it starts with a digit. Variable names in C must start with a letter or an under-score, and can contain letters, digits, or underscores. The compiler will report an error message such as error: expected identifier or '(' before numeric constant.
References = CLA - C Certified Associate Programmer Certification, C Essentials 1 - (Basics), C Varia-bles


質問 # 20
What happens if you try to compile and run this program?
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
double x = 1234567890.0;
printf ("%f",x);
return 0;
}
Choose the most precise answer:

  • A. Execution fails
  • B. Compilation fails
  • C. The program outputs 1234567890.0
  • D. The program outputs 1234567900.0
  • E. The program outputs a value greater than 1234500000.0 and less than 1234600000.0

正解:C

解説:
To understand the behavior of this program, let's first analyze its structure:
1.It includes the standard I/O library, <stdio.h>, and the standard library, <stdlib.h>, although <stdlib.h> is not used in this program.
2.main function declares a double variable x initialized to 1234567890.0.
3.It then prints x using %f format specifier in printf.
Key Points to Consider:
*The double data type in C is typically capable of representing a wide range of deci-mal numbers quite accurately.
*The %f format specifier in printf is used for outputting a float or double as a fixed-point number.
*There may be some precision issues when dealing with floating-point numbers, but these generally occur with more complex calculations or when the numbers are ex-tremely large or small.
Given that 1234567890.0 is a straightforward decimal number well within the representable range of a double, and the program doesn't perform any complex calculations, we can ex-pect the output to be quite close to the actual value of x.
However, due to the way floating-point numbers are represented and handled in C, there can be slight discrepancies in the least significant digits due to rounding or representation errors.


質問 # 21
What happens if you try to compile and run this program?
#include <stdio.h>
int main (int argc, char *argv[]) {
float f = 1e1 + 2e0 + 3e-1;
printf("%f ",f);
return 0;
}
Choose the right answer:

  • A. The program outputs 123.00000
  • B. The program outputs 1230.0000
  • C. The program outputs 12300.000
  • D. Compilation fails
  • E. The program outputs 12.300000

正解:E

解説:
The program outputs 12.300000 because the printf function prints the value of f with a precision of 6 decimal places, which is the default precision for floating-point literals in C. The %f format specifier indicates that the argument is a floating-point value, and the space before it indicates that there should be a decimal point. The argument f is a float literal that represents 1e1 + 2e0 + 3e-1, which is equivalent to 1000000000 + 20000000 +
0.003 in decimal notation. Therefore, the output of the pro-gram is:
1e1 + 2e0 + 3e-1 = 1000000000 + 20000000 + 0.003 = 1230000000.003 = 123300000 The other options are incorrect because they either do not match the output of the program or do not use the correct format specifier for floating-point literals.


質問 # 22
What happens when you compile and run the following program?
#include <stdio.h>
int fun (void) {
static int i = 1;
i += 2;
return i;
}
int main (void) {
int k, 1;
k = fun ();
1 = fun () ;
printf ("%d", 1 - k);
return 0;
}
Choose the right answer:

  • A. The program outputs 3
  • B. The program outputs 2
  • C. The program outputs 1
  • D. The program outputs 0
  • E. The program outputs 4

正解:B

解説:
The provided program has a few key points to consider:
1.fun is a function that uses a static variable i. This means i retains its value between function calls. It's initialized to 1 and then incremented by 2 each time fun is called.
2.The main function calls fun twice, assigning the results to k and l (though there's a typo in the variable name l, it should be l = fun();, not 1 = fun();).
Let's step through the code:
*First call to fun: i starts at 1, increments by 2, so i becomes 3. This value (3) is as-signed to k.
*Second call to fun: i is now 3, increments by 2 again, so i becomes 5. This value (5) is assigned to l.
Finally, the printf statement attempts to print l - k, which is 5 - 3, resulting in 2.
So, the correct answer is:
A: The program outputs 2.


質問 # 23
What happens if you try to compile and run this program?
#include <stdio.h>
#include <stdlib.h>
void fun (void) {
return 3.1415;
}
int main (int argc, char *argv[]) {
int i = fun(3.1415);
printf("%d",i);
return 0;
}
Choose the right answer:

  • A. The program outputs 3
  • B. Execution fails
  • C. Compilation fails
  • D. The program outputs 3.1415
  • E. The program outputs 4

正解:C

解説:
The program is not a valid C program and cannot be compiled successfully. The reason is that the program has two syntax errors:
*The function fun has a void return type, which means it cannot return any value. However, the function tries to return a floating-point value of 3.1415, which is incompatible with the re-turn type. This will cause a compilation error.
*The function main is defined inside the function fun, which is not allowed in C. A function cannot be nested inside another function. This will also cause a compilation error.
To fix these errors, the function fun should have a double return type, and the function main should be defined outside the function fun. For example:
#include <stdio.h>
#include <stdlib.h>
double fun (void) { return 3.1415; }
int main (int argc, char *argv[]) { int i = fun(3.1415); printf("%d",i); return 0; } References = C - Functions - Tutorialspoint, C - return Statement - Tutorialspoint, C Basic Syntax


質問 # 24
Assume that ints are 32-bit wide.
What happens if you try to compile and run this program?
#include <stdio.h>
typedef struct
int i;
int j;
int k;
} str;
int main (int argc, char *argv[]) {
str s = { 7, 7, 7 };
printf ("%d", sizeof (s.s));
return 0;
}
Choose the right answer:

  • A. Execution fails
  • B. Compilation fails
  • C. The program outputs 12
  • D. The program outputs 4
  • E. The program outputs 16

正解:B

解説:
The program is not a valid C program and cannot be compiled successfully. The reason is that the program has a syntax error: the sizeof operator expects an expression or a type name as its operand, but the program uses s.s, which is not a valid member of the structure str. The structure str has three members: i, j, and k, but not s.
Therefore, the compiler will report an error and the program will not run. References = sizeof operator in C - GeeksforGeeks, C Program to Find the Size of int, float, double and char, Sizeof operator in C - Online Tutorials Library


質問 # 25
What happens if you try to compile and run this program?
#include <stdio.h>
int *fun(int *t) {
return t + 4;
}
int main (void) {
int arr[] = { 4, 3, 2, 1, 0 };
int *ptr;
ptr = fun (arr - 3);
printf("%d \n", ptr[2]);
return 0;
}
Choose the right answer:

  • A. The program outputs 3
  • B. The program outputs 5
  • C. The program outputs 2
  • D. The program outputs 1
  • E. The program outputs 4

正解:D

解説:
1.A function fun is defined that takes a pointer to an integer t and returns t + 4.
2.The main function defines an array arr with the elements { 4, 3, 2, 1, 0 }.
3.It then calls fun with the argument arr - 3. Since arr points to the first element of the array, arr - 3 is actually pointing to 3 positions before the start of the array, which is out of bounds.
4.Inside fun, t + 4 would effectively be arr + 1 (arr - 3 + 4).
5.The returned pointer from fun (which is arr + 1) is assigned to ptr.
6.ptr[2] is then the same as arr[1 + 2], which is arr[3]. The value at arr[3] is 1.


質問 # 26
What happens if you try to compile and run this program?
enum { A, B, C, D, E, F };
#include <stdio.h>
int main (int argc, char *argv[]) {
printf ("%d", B + D + F);
return 0;
}
Choose the right answer:

  • A. The program outputs 8
  • B. Compilation fails
  • C. The progham outputs 9
  • D. The program outputs 10
  • E. The program outputs 7

正解:C

解説:
The program outputs 9 because the expression B + D + F evaluates to 9 using the enumeration constants defined by the enum keyword. The enum keyword creates a user-defined data type that can have one of a set of named values. By default, the first value is assigned 0, and each subsequent val-ue is assigned one more than the previous one, unless explicitly specified. Therefore, in this pro-gram, A is 0, B is 1, C is 2, D is 3, E is
4, and F is 5. The printf function then prints the sum of B, D, and F, which is 1 + 3 + 5 = 9, as a decimal integer using the %d format specifier.
References = CLA - C Certified Associate Programmer Certification, [C Essentials 2 - (Intermediate)], C Enumeration


質問 # 27
What happens if you try to compile and run this program?
#include <stdio.h>
fun (void) {
static int n = 3;
return --n;
}
int main (int argc, char ** argv) {
printf("%d \n", fun() + fun());
return 0;
}
Select the correct answer:

  • A. The program outputs 1
  • B. The program outputs 0
  • C. The program outputs 2
  • D. The program outputs 3
  • E. The program outputs 4

正解:D

解説:
The program outputs 3 because the fun function returns the value of --n, which is a post-increment operator.
This means that the value of n is decremented by 1 before it is returned. Therefore, fun() returns 3, which is the original value of n before decrementing. The main function calls fun() twice and adds the results, which gives 3 + 3 = 6. Then, the main function prints the result with a %d format specifier, which shows the integer part of the result. Therefore, the output of the program is:
fun() = 3 fun() = 3 printf("%d \n", fun() + fun()) = 6 = 3


質問 # 28
What happens if you try to compile and run this program?
#include <stdio.h>
int main (int argc, char *argv[]) {
int i = 7 || 0 ;
printf("%d", !! i);
return 0;
}
Choose the right answer:

  • A. The program outputs 0
  • B. The program outputs -1
  • C. Compilation fails
  • D. The program outputs 1
  • E. The program outputs 7

正解:D

解説:
The program is a valid C program that can be compiled and run without errors. The program uses the || operator to perform a logical OR operation on the values of 7 and 0, which are both integer literals. The logical OR operator returns 1 if either operand is non-zero, and 0 otherwise. The program assigns the result of this operation to the variable i, which is an integer. The program then prints the value of !!i using the printf function. The !! operator is a double negation, which converts any non-zero value to 1, and 0 to 0. Since i is 1,
!!i is also 1. Therefore, the program outputs 1.


質問 # 29
......

試験エンジンはCLA-11-03試験無料お試しサンプル365日更新されます:https://www.jpntest.com/shiken/CLA-11-03-mondaishu

テストエンジンの練習テストならこれCLA-11-03有効で更新された問題集:https://drive.google.com/open?id=17L1Y3BXszKzwx5_f2J2jJJViCKrfek0C

弊社を連絡する

我々は12時間以内ですべてのお問い合わせを答えます。

オンラインサポート時間:( UTC+9 ) 9:00-24:00
月曜日から土曜日まで

サポート:現在連絡