Bangladesh Power Development Board(BPDB)
Post: Assistant Engineer (CSE)
Exam Date: 24-02-2023, Exam Taker: BUET
Power=bpdb*(nuclear+coal+hydro)
The total number of tokens generated by the logical analyzer for the given C statement Power=bpdb*(nuclear+coal+hydro) is 11 tokens, identified as follows:
- Identifier:
Power - Assignment operator:
= - Identifier:
bpdb - Multiplication operator:
* - Left parenthesis:
( - Identifier:
nuclear - Addition operator:
+ - Identifier:
coal - Addition operator:
+ - Identifier:
hydro - Right parenthesis:
)
Each part of the statement is considered a separate token, including operators, parentheses, and identifiers.
In Linux, there are three types of users who can access a file or directory:
Owner:
The user who owns the file or directory. The owner typically has full read, write, and execute permissions by default.Group:
A group of users who share the same access permissions for the file or directory. Permissions can be specifically assigned for read, write, and execute actions.Other:
Any user who is neither the owner nor a member of the assigned group. These users can also be given specific permissions to read, write, or execute the file or directory.
Note: Permissions in Linux are set using the chmod command, which allows the owner, group, and others to be granted specific access to the file or directory.
To find the total number of .c and .h files in the current directory, you can use the following Linux command:
ls *.c *.h | wc -l
Explanation:
ls *.c *.h: Lists all files in the current directory with the.cor.hextensions using wildcards (*).|: Pipes the output of thelscommand to the next command.wc -l: Counts the number of lines in the output, which corresponds to the total number of.cand.hfiles.
This command will output the total count of .c and .h files in the current directory.
To find the maximum subarray, which is a contiguous subarray with the largest sum, Kadane’s Algorithm is used. Here’s how it works for the given array A = [-2, 1, -3, 1, 2, 1, -5, 4]:
Steps:
Initialize two variables:
max_so_far: This keeps track of the largest sum of any subarray found so far. Set this to the first element of the array.max_ending_here: This tracks the maximum sum of the subarray ending at the current position. Set this to the first element of the array.
Iterate through the array starting from the second element:
- For each element in the array:
- Update
max_ending_hereto the greater of:- The current element itself (indicating starting a new subarray).
- The current element added to
max_ending_here(continuing the current subarray).
- Update
max_so_farto the greater of:- The current
max_so_far. max_ending_here.
- The current
- Update
- For each element in the array:
Final Result:
- At the end of the process,
max_so_farwill hold the largest subarray sum.
- At the end of the process,
a. (0+1) *0011 (0+1)* +(0+1) *1100 (0+ 1)*
b. (0+1) *(00(0+1)*11+11(0+1)*00) (0+ 1)*
c. (0+1) *00 (0+1)* +(0+1) *11 (0 + 1)*
d. 00 (0+1) *11 + 11 (0+1) *00
The regular expression that represents the language of all binary strings containing at least two consecutive 0s and two consecutive 1s is option (b):
(0 + 1)*(00(0 + 1)*11 + 11(0 + 1)*00)(0 + 1)*
Explanation:
(0 + 1)*:- Matches any sequence of
0s and1s (including an empty sequence). This allows any binary string before encountering the required pattern.
- Matches any sequence of
00(0 + 1)*11:- Matches a sequence starting with two consecutive
0s, followed by any binary sequence, and ending with two consecutive1s. This ensures the string contains at least two consecutive0s and1s in this specific order.
- Matches a sequence starting with two consecutive
11(0 + 1)*00:- Matches a sequence starting with two consecutive
1s, followed by any binary sequence, and ending with two consecutive0s. This ensures the string contains at least two consecutive1s and0s in this specific order.
- Matches a sequence starting with two consecutive
(0 + 1)*:- Matches any sequence of
0s and1s after encountering the required pattern.
- Matches any sequence of
Agent Environment in Artificial Intelligence
An agent environment in Artificial Intelligence refers to the surroundings or conditions in which an agent operates, perceives inputs, and takes actions.
- Agent: An entity that perceives the environment through sensors and acts upon it using actuators.
- Environment: Everything outside the agent that it interacts with.
- Function: The environment provides inputs to the agent, and the agent responds with actions.
Types of Environment:
- Fully Observable / Partially Observable
- Deterministic / Stochastic
- Static / Dynamic
- Discrete / Continuous
Artificial Intelligence-এ Agent Environment
Agent environment হলো সেই পরিবেশ বা অবস্থা যেখানে একটি agent কাজ করে, input গ্রহণ করে এবং action নেয়।
- Agent: একটি entity যা sensor দিয়ে environment থেকে তথ্য গ্রহণ করে এবং actuator দিয়ে কাজ করে।
- Environment: Agent-এর বাইরে থাকা সবকিছু যার সাথে agent interaction করে।
- Function: Environment agent-কে input দেয় এবং agent সেই অনুযায়ী action নেয়।
Environment-এর ধরন:
- Fully Observable / Partially Observable
- Deterministic / Stochastic
- Static / Dynamic
- Discrete / Continuous
