Computer Knowledge
Programming Fundamentals
2,381 Questions
Programming fundamentals form the core logic of software development and computer science. This includes variable declarations, pointer assignments, loop iterations, and exception handling. These technical topics are regularly tested in computer knowledge and IT officer competitive examinations.
Variables and arraysPointer assignmentsLoop iterationsException handling blocksCompile time errorsFunction references
Programming Fundamentals Questions
-
((1 2 3 4 5 6))
-
(1 2 3 4 5 6)
-
()
-
(4 5 6 1 2 3)
C
Correct answer
Explanation
append returns a NEW list with combined elements - it does not modify the original lists. list3 remains empty because append was not assigned back to list3. The correct expression would be (set! list3 (append list3 list1 list2)).
-
Bitwise XOR
-
Bitwise OR
-
Logical OR
-
Logical AND
A
Correct answer
Explanation
Among the listed operators, Bitwise XOR (^) has the highest precedence. The precedence order is: Bitwise XOR (^) > Bitwise OR (|) > Logical AND (&&) > Logical OR (||). The answer is A because XOR ranks highest. Bitwise operators generally have higher precedence than logical operators, and within bitwise operators, XOR outranks OR. This affects expressions like a ^ b | c - XOR binds tighter.
-
Run time
-
Compile time
-
Depends on how it is invoked
-
Both b and c
B
Correct answer
Explanation
Inline functions are expanded in place by the compiler at compile time rather than being invoked via normal function call overhead at run time. This direct expansion reduces execution overhead, making compile time the correct phase for this mechanism.
-
Terminate()
-
end()
-
abort()
-
exit()
C
Correct answer
Explanation
The abort() library function in C and C++ causes abnormal program termination by generating a SIGABRT signal, effectively aborting the program immediately without standard cleanup. Functions like exit() perform normal cleanup before terminating.
-
It can abort the program
-
It can cause a failure
-
It can cause an error
-
It can cause a trap
D
Correct answer
Explanation
Deleting a pointer twice causes undefined behavior, often manifesting as a CPU trap when the memory manager detects the invalid operation. The program may crash or corrupt memory silently.
-
Static binding
-
Dynamic binding
-
-
-
--
B
Correct answer
Explanation
Dynamic binding allows the program to determine which function implementation to call at runtime based on the actual object type, rather than the pointer/reference type. This enables runtime polymorphism through virtual functions.
-
During flow execution as process conrtol advances from one task to another
-
At the end of activity step,after invoking the method, but before any transition step
-
Upon database commit when any object is saved to database
-
All of the above
D
Correct answer
Explanation
Declare rules (like Declare Expressions, Constraints, and OnChange) execute automatically. They run during flow execution, at the end of activity steps, or upon database commits depending on the rule type, making 'All of the above' correct.
-
(a) They are stored on the clipboard as temporary variables
-
(b) They exist only within the context of an activity
-
(c) They can be stored in the database
-
(d) They are stored in a named page that is created automatically
B
Correct answer
Explanation
Local variables in Pega are activity-specific. They exist only during the execution of that activity and are not stored persistently. They are not stored on the clipboard as temporary variables (A), cannot be stored in the database (C), and are not stored in automatically created named pages (D). Their scope is strictly limited to the activity context.
-
(a) Do not have any connectors emanating from the Flow shape
-
(b) In the Flow parameters, select Branch, not Call
-
(c) You cannot use a Flow shape to branch to another flow
-
(d) none of these
A
Correct answer
Explanation
To branch to another flow without returning control, you simply do not have any connectors emanating from the Flow shape. This creates a one-way transfer - execution continues in the called flow and never returns to the original flow. The Flow parameters do not have a 'Branch' option.
-
During flow execution as process conrtol advances from one task to another
-
At the end of activity step,after invoking the method, but before any transition step
-
Upon database commit when any object is saved to database
-
All of the above
D
Correct answer
Explanation
Declare rules in Pega (like Declare Expressions, Constraints, OnChange, and Triggers) execute automatically based on their configuration: during forward/backward chaining as control advances, after activity steps before transitions, or upon database commits.
C
Correct answer
Explanation
-> (arrow operator) is correct because it is used with pointers to access members of an object. The dot operator (A) is used with object references, commas (B) are separators, and > (D) is a comparison or stream operator. The this pointer is a pointer, so it uses -> for member access.
-
Foo d = c;
-
Foo *d = c;
-
Foo d; d=c;
-
--
B
Correct answer
Explanation
In Java, object variables are references by default, so Foo d = c; makes d reference the same object as c. In C++, the equivalent behavior requires using a pointer: Foo *d = &c; (note the address-of operator). However, in the context of this question's options, Foo *d = c; is the closest C++ pointer declaration equivalent, as C++ pointers are used to achieve reference-like behavior. Option A would be value semantics (copy), not reference semantics.
-
Clipboard
-
Tracer
-
Performance tool
-
Rules Inspector
B
Correct answer
Explanation
The Tracer tool in Pega is specifically designed to trace and debug requestor sessions, including showing the values of parameters at each step. Clipboard shows the current page structure but doesn't provide runtime tracing capability. Performance tool is for load testing, and Rules Inspector is for viewing rule definitions.
-
Operator
-
Deny
-
Rule Set
-
Class
B
Correct answer
Explanation
In Pega, a 'Deny' rule is used to explicitly deny access to specific functionality or rules for certain users or access groups. While Operators, Rule Sets, and Classes are all part of Pega's security model, the specific rule type used to restrict access is the Deny rule.
-
Property reference
-
Literal
-
Function
-
Boolean expression
-
Activity call
A,B,C,D
Correct answer
Explanation
Models can contain property references (page.property), literals (constant values), functions (built-in functions), and boolean expressions (conditions). Activity calls are not allowed in models - models define data transformation, not execution flow.