# 2.2 Analizowac Programy I Algorytmy

Approved & Edited by ProProfs Editorial Team
At ProProfs Quizzes, our dedicated in-house team of experts takes pride in their work. With a sharp eye for detail, they meticulously review each quiz. This ensures that every quiz, taken by over 100 million users, meets our standards of accuracy, clarity, and engagement.
| Written by Szymek2231
S
Szymek2231
Community Contributor
Quizzes Created: 1 | Total Attempts: 131
Questions: 10 | Attempts: 131  Settings  Quiz 2.2

• 1.

### #include <iostream> #include <cstdio> using namespace std; int main() { cout << "To jest moj pierwszy program"; getchar(); return 0; }                                                                                                                 Program wyświetli?

• A.

Napis z warunku "cout"

• B.

Program nic nie wyświetli

• C.

Wyswietli 0

• D.

Wyswietli napis "cout"

A. Napis z warunku "cout"
Explanation
The correct answer is "napis z warunku 'cout'". This is because the line "cout

Rate this question:

• 2.

### #include <iostream> #include <cstdio> using namespace std; int main() {         int liczba; // deklaracja zmiennej cout << "Podaj liczbe "; cin >> liczba; // przypisanie wartości z klawiatury if (liczba>0) // instrukcja warunkowa cout << "Liczba jest dodatnia"; else cout << "Liczba nie jest dodatnia"; cin.ignore(); getchar(); return 0; }                                                                                                   program zawiera instrukcje?

• A.

Wyboru

• B.

Warunkową

• C.

Iteracyjną

• D.

Sortowania

B. Warunkową
Explanation
The given program contains an if-else statement, which is a conditional statement used for decision making. It checks if the value of the variable "liczba" is greater than 0. If it is, the program prints "Liczba jest dodatnia" (The number is positive). Otherwise, it prints "Liczba nie jest dodatnia" (The number is not positive). This indicates that the program includes a conditional (or selection) statement.

Rate this question:

• 3.

### Instrukcja warunkowa to inaczej?

• A.

While...

• B.

For...

• C.

If...else

• D.

Do...

C. If...else
Explanation
The correct answer is "if...else" because an "if...else" statement is a conditional statement that allows a program to make decisions based on certain conditions. It checks if a condition is true, and if it is, it executes a certain block of code. If the condition is false, it executes a different block of code. This statement is commonly used when there are two possible outcomes or actions based on a condition.

Rate this question:

• 4.
• A.

X=0; while (x

• B.

X=0; do {x++;} while (x>10)

• C.

X=0; do {x=x+1;} while (x

• D.

For (x=0;x

A. X=0; while (x
• 5.

### #include <iostream> int main() { int ile = 4; do {                   std::cout << "Napis" << std::endl; ile--; } while( ile > 0 ); return 0; }                                                                                                   Jaka pętla została tu użyta?

• A.

To be...or not to be

• B.

For...

• C.

If...else

• D.

Do...while

D. Do...while
Explanation
The correct answer is "do...while" because the code uses the do-while loop structure. In this loop, the code block is executed at least once before the condition is checked. In this case, the code block prints the string "Napis" and decreases the value of the variable "ile" by 1. The loop continues until "ile" is greater than 0.

Rate this question:

• 6.

### #include <iostream> #include <cstdio> using namespace std; int main() {                for (int i=0; i<20; i++) { cout << i; if (i%3!=0) // jeśli reszta z dzielenia przez 3 jest różna od zera cout << " - nie jest podzielne przez 3, "; cout << endl; } getchar(); return 0; }                                                                                program wyświetli?

• A.

Liczby parzyste od 1 do 20

• B.

Liczby od 1 do 20

• C.

Liczby nieparzyste od 1 do 20

• D.

Liczby od 0 do 19

B. Liczby od 1 do 20
Explanation
The program will display numbers from 1 to 20. The for loop iterates from 0 to 19, and at each iteration, the value of i is printed. If i is not divisible by 3, a message indicating that it is not divisible by 3 is also printed. Since the loop starts from 0 and ends at 19, the numbers displayed will be from 1 to 20.

Rate this question:

• 7.

### Begin writeln('Hello World'); end.                                                           Program napisany jest w języku?

• A.

Java

• B.

C++

• C.

Pascal

• D.

C--

C. Pascal
Explanation
The given program is written in the Pascal programming language. This can be determined by looking at the syntax used in the program, which is typical of Pascal. The program starts with the keyword "begin" and ends with the keyword "end.", which are both used in Pascal to mark the beginning and end of a program. Additionally, the "writeln" statement is also commonly used in Pascal to output text to the console.

Rate this question:

• 8.

### Zmienna "short" ma zakres ?

• A.

Od -32 768 do 32 767

• B.

Od -128 do 127

• C.

True/false

• D.

od -32 767 do 32 768

A. Od -32 768 do 32 767
Explanation
The correct answer is "od -32 768 do 32 767". This is because a "short" variable in programming typically has a range from -32,768 to 32,767.

Rate this question:

• 9.

### Jaki znakie graficzny stosuje sie w jezyku c++ by ukazac negacje?

• A.

?

• B.

&&

• C.

\$

• D.

!

D. !
Explanation
The correct answer is "!". In the C++ language, the exclamation mark is used to represent the negation operator. It is commonly used in conditional statements and logical expressions to reverse the value of a boolean variable or expression. For example, "if (!condition)" means "if the condition is false".

Rate this question:

• 10.

### Ile bajtów ma zmienna "int" ?

• A.

4 bajty

• B.

2 bajty

• C.

8 bajtów

• D.

1 bajt Back to top